Re: memory allocation trouble
2005-08-31 11:10:47 PM
cppbuilder30
Tamas Demjen <
XXXX@XXXXX.COM >wrote:
Quote
Joel Beer wrote:
>I recently added 2GB of RAM to my PC bringing the total memory (RAM) to 3GB. Using calloc under C++Builder 6.0 Pro, however, I can only allocate a maximum of about 600MB. What can I do to allocate more physical RAM? I would like to allocate about 1.8GB total memory.
You apparently can't allocate such large contiguous memory. You may have
1.8GB free memory, but not in a single, contiguous block. They are all
scattered over the address space in smaller segments. The memory is
fragmented, and the system is unable to find you such a large block at
once. I recommend that if it's possible, try to allocate it in smaller
chunks, such as 100-500MB chunks. For example, try to use the deque<T>
STL container, instead of calloc. If you must absolutely need a
contiguous block of that size, ensure that no other application is
running on the system, and allocate the block first thing after
launching it, and never delete it until the app exits. Even then it
can't be guaranteed that the system will give you a 2GB contiguous chunk.
Tom
Thanks. Can get about 1.6GB for the application if allocated
in 100MB chunks. Looks like the other 300MB or so is used for WIN XP and BB.
Now if I can just figure out how to get access to the other GB
of RAM. Tried every permutation of /3GB and /userva that I could think of. May need to up the memory to /4GB before the /3GB switch works.
--joel