HeapAlloc 返回 0xC0000017:配额不足
我分配了少量数据类型,总大小为 2mb。
我只使用一个堆,它运行良好,直到我达到一定数量的分配,我对此非常确定,因为我已经评论了一个分配,使其在下一个分配时崩溃。
配额=磁盘空间?该文档没有涵盖此特定函数的错误代码,我已经分析了该应用程序,并且为该进程分配了足够的可用内存。我还在堆指针上放置了一个数据断点,它没有中断。当我单步执行直到调用 HeapAlloc 之前,堆指针都很好。
太奇怪了..
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..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试分配大块内存(即 >2MB),直到出现错误为止,以确定问题是对象数量还是总堆。另外,你确定你分配的内存没有超过2MB吗?我在达到 2GB 限制时见过该错误,但在达到 2MB 时从未见过该错误,除非您的页面文件已满。
如果所有其他方法都失败,请重新启动或尝试在不同的计算机上。
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.
根据 WinNt.h 异常代码
C0000017
中的值映射到STATUS_NO_MEMORY
这是 HeapAlloc 将抛出异常。因此,您要么内存不足,要么溢出了分配的缓冲区之一并损坏了堆。According to that values in WinNt.h exception code
C0000017
maps toSTATUS_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.