none
Resolution to Heap Fragmentation If HeapAlloc() Return STATUS_NO_MEMORY? RRS feed

  • Question

  • My application utilizes a lot of memory and it runs in a PC of 2G RAM.

    However, running after few hours, the program encountered STATUS_NO_MEMORY when calling to HeapAlloc()!

    To handle the exception, the program's handler would call HeapValidate() to ensure that the heap is consistent and then did a successful call to HeapCompact(). Right after that, a repeat call to HeapAlloc() of that same size (3K) would fail again but a request of few bytes would succeed. (By the time, the tark manager showed that the application only consumed 200s M RAM and 200s M VM.)

    MSDN indicates that private heap could suffer from heap fragmentation.
    I would like to know how can I be sure STATUS_NO_MEMORY was caused by fragmentation (since the system still has a lot of memory)? And any resolution to this if it is because of fragmentation?


    Friday, September 9, 2005 3:13 AM

Answers