Re: Memory occupied by Map
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Thu, 12 Jun 2008 22:27:31 -0500
On Thu, 12 Jun 2008 17:12:29 -0700 (PDT), "alien.0101@xxxxxxxxx"
<alien.0101@xxxxxxxxx> wrote:
Hi
I want to know the memory occupied by Map, Is there a way to do that.
I have written a sample application and adding value to map doesnot
change size
map<int,int> mapInt2Int;
mapInt2Int[1]=2;
mapInt2Int[2]=2;
mapInt2Int[3]=2;
mapInt2Int[4]=2;
mapInt2Int[5]=2;
mapInt2Int[6]=2;
size_t sz= sizeof(mapInt2Int);
The result of the sizeof operator is a constant fixed at compile-time.
How can I find how much bytes does the map uses.
You can't, at least not without becoming steeped in the details of the
implementation.
My main requirement is to store the map as a byte blob in database and
rettrieve back.
any thoughts???
Serialize the map as (key, value) pairs.
--
Doug Harrison
Visual C++ MVP
.
- Follow-Ups:
- Re: Memory occupied by Map
- From: alien.0101@xxxxxxxxx
- Re: Memory occupied by Map
- References:
- Memory occupied by Map
- From: alien.0101@xxxxxxxxx
- Memory occupied by Map
- Prev by Date: Re: Memory occupied by Map
- Next by Date: Re: Memory occupied by Map
- Previous by thread: Re: Memory occupied by Map
- Next by thread: Re: Memory occupied by Map
- Index(es):
Relevant Pages
|
Loading