Re: Memory occupied by Map
On Jun 13, 3:01 am, "Daniel T." <danie...@earthlink.net> wrote:
"alien.0...@gmail.com" <alien.0...@gmail.com> wrote:
I have written a sample application and adding value to map doesnot
sizeof() returns the *static* size of an object/type, the value is
determined at compile time and never changes.
How can I find how much bytes does the map uses.
You can't do it in any portable way.
You can, sort of. You write a custom allocator which tracks how
much is allocated, and instantiate the map with that.
Whether the information is in anyway useful, of course, is
My main requirement is to store the map as a byte blob in
database and rettrieve back.
That doesn't sound like a very good idea. A map is an
associative array, so is a database table. Why not store the
former as the latter?
For example. More significantly, of course, an std::map is
*not* a byte blob, so it can't be stored directly as such. If
for any reason you need to store it as a byte blob in a
database, you'll first have to marshal it.
James Kanze (GABI Software) email:email@example.com
Conseils en informatique orient=EF=BF=BDe objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=EF=BF=BDmard, 78210 St.-Cyr-l'=EF=BF=BDcole, France, +33 (0)1 30 2=
3 00 34