• Advertisement
Sign in to follow this  

STL size of memory

This topic is 4944 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement