My program contains a CMap containing 300byte objects. When I load objects from a 600kb file (approx 2000 objects) into memory using CMap::Serialize() the windows swap file (win386.swp) blows completely out of proportion. I need about 2Gb free on my hard drive before the de-serializing works. The file contains approximately two thousand 300byte objects and I would expect the memory needed to be similar in size to the hard disk space needed which is only 600kb. My objects DO NOT allocate any extra memory! Can someone tell why the program needs so much memory.
Update: The CMap default constructor is below:
CMap( int nBlockSize = 10 );
I have been constructing my CMaps with nBlockSize=4096. I assumed the BlockSize is in bytes. At
this point I am beginning to wonder if it means the number of blocks of system memory. I think
windows NT has a block size of either 2048 or 4096Bytes which means I may be allocating 4096
blocks of 2048Bytes for each of the 2000 objects.