c++winapiheap-memoryquotaheapalloc

HeapAlloc returns 0xC0000017: Not Enough Quota


I'm allocating a small number of data types, total size 2mb.

I only use one heap, and it runs fine until I get to a certain number of allocations, I'm pretty sure of this because I've commented one allocation for it to crash on the next.

Quota = disk space? the documentation doesn't cover error codes for this specific function, I've profiled the application and there's plenty of memory free allocated for the process. Also I put a data breakpoint on the heap pointer, and it doesn't break. The heap pointer is fine when i step through, up to my call to HeapAlloc.

So strange..


Solution

  • Try allocating a large chunk of memory (i.e. >2MB) until you get the error to determine if the issue is the # of objects or total heap. Also, are you sure you aren't allocating more than 2mb memory? I've seen that error when the 2gb limit is hit, but never at 2mb unless your pagefile is full.

    If all else fails, reboot or try on a different machine.