STL size of memory

Started by
2 comments, last by C-Junkie 19 years, 9 months ago
I'm wondering if there's a way to get the actual amount of memory a STL container, or specificly map, is using? The reason for this is that, the map is allocated on a shared memory segment. And when the map grows the segment eventually "runs out" of memory.. any ideas? (that is, shared memory segment by shmget() on linux) /Nico
Advertisement
Quote:Original post by NicoDeLuciferi
I'm wondering if there's a way to get the actual amount of memory
a STL container, or specificly map, is using?

The reason for this is that, the map is allocated on a shared
memory segment. And when the map grows the segment eventually
"runs out" of memory..

any ideas?

(that is, shared memory segment by shmget() on linux)

/Nico
Wow. Um.... If you're using shared memory, then you MUST be using a custom allocator to make sure everything is allocated insinde that shared region.

So, your allcoator should know how much is left.
was afraid of that.. :)

thanks for the quick reply..

but if we disregard the shared memory.. is there a way to get
the amount of memory used?

/Nico
The only way I can think of is with a custom allocator.

Even a really thin wrapper around malloc/free (or whatever you want to use)

This topic is closed to new replies.

Advertisement