views:

421

answers:

2

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..

+1  A: 

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.

Andrew
i'm just loading a 1mb file as part of a simple game, there's no way it could be > 2gb!allocating 2gb or 3gb fails.. hmm, maybe it's to do with 64bit pointers? I rebooted already, I'll try debugging on a 32bit vm.
Sorlaize
So you can allocate 1gb, but not 2gb? Is it possible that you have a back that is allocating too much memory? Maybe track how many times you call the allocation, and how much you allocate each time.
Andrew
yeah, i can allocate 1gb fine, I must be messing with pointers too much. I visualized the allocation so I could see the 1gb allocation left me another 500mb or so, and when stepping through the problem code afterward, it didn't go over 2gb in its entirety.Thanks so much for your help!!
Sorlaize
+1  A: 

According to that values in WinNt.h exception code C0000017 maps to STATUS_NO_MEMORY which is one of the exceptions that HeapAlloc will throw. So you are either out of memory or you've overflown one of your allocated buffers and corrupted the heap.

shf301