"No memory" while plenty of memory 
Author Message
 "No memory" while plenty of memory


I am debugging a console application that uses a plenty of memory. It is a
single module app (EXE only, no DLLs), plain C. When a malloc/calloc call
returns 0 (no more memory), I call
GetProcessMemoryInfo and print the PageFileUsage field of the
_PROCESS_MEMORY_COUNTERS. What I can see for some cases is that program
reports "no memory" while the PageFileUsage (which I hope is the total VM in
use by my program) is quite far from 2Gb (1.3 Gb, for example). The memory
chunk to be allocated at that time is not that big (1 to 10-20 Mb). The VM
Size column in the Task Manager reports the same value for the program. It
happens in both debug and release modes.

What is wrong with that? Or the actual virtual space used is PageFileUsage
plus WorkingSetSize?

Windows 2000, VC 6.0 + SP5.

Thank you!


Sat, 07 Feb 2004 04:18:28 GMT  
 "No memory" while plenty of memory

Yes, the total VM used should be the working set plus the current page file
usage. You can use tlist to check the total VM usage.

It is possible that allocating large amount of memory if there is not an
address block big enough to contain the memory you specified in malloc.

Hope this information is useful for you.


Sat, 07 Feb 2004 20:19:06 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Error "free"-ing "malloc"-ed memory

2. Memory could not be "read"

3. "C Pointers and Dynamic Memory Management"

4. memory allocation / "dynamic arrays" / portability

5. Problem getting "memory cannot be read"

6. "memory clobbered before allocated block"...?

7. extended-memory "C"?

8. "Invalid access to memory location" error

9. "Memory cannot be read"?

10. ERROR: memory cannot be "read"

11. memory "read" error

12. ERROR: memory could not be "read"


Powered by phpBB® Forum Software