Link to home
Start Free TrialLog in
Avatar of aderounm
aderounmFlag for United States of America

asked on

Use of CMap blows up swap file

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.
Avatar of snoegler
snoegler

Why do you have deleted your previous question?
Avatar of aderounm

ASKER

Edited text of question
Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Saved! I wonder how I missed that. I was about 48 hours away from  buying a new hard drive.