VirtualMemory works with buckets, the default size of a bucket is 128 wasm pages, i.e. 8MB, meaning that by default, that’s the minimum size a data structure will take up in stable memory (or a multiple of that if the data structure gets bigger). You can use MEMORY_MANAGER .get(..).size() to get the allocated memory for a bucket (in wasm pages).
Even within StableBTreeMap, the implementation works with pages (the size of which depends on the data type stored in the map, see it here), so the space the StableBTreeMap actually takes up in the VirtualMemory is a multiple of this (+ some metadata per page).
Because there is no clear definition of size, the library doesn’t expose this data in a public API, however, you could fork it and access the allocator field inside StableBTreeMap and read allocator.num_allocated_chunks() * allocator.chunk_size().
If you tell us about your use-case, perhaps we can give you more advice.