如何在堆内存中没有剩余空间状态? [英] How to get no space left status on the heap memory?
本文介绍了如何在堆内存中没有剩余空间状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试安全地执行大量的堆分配情况。
Hi, I'm trying safely implementation for a lot of heap allocating situation.
例如测试:
#include <stdlib.h>
#include <stdint.h>
int main(int argc, char *argv[])
{
while (1)
{
// Try allocate buffer from the heap.
uint8_t* pBuffer = (uint8_t*)malloc(0x1000);
// If cause failure allocation:
if (pBuffer == NULL)
{
// We'll make safer for dependent...
// (ex: Will free unused another heaps.)
break;
}
}
return 0;
}
推荐答案
感谢报告这个kekyo。我们在内部看它!
Thanks for reporting this kekyo. We are looking at it internally!
这篇关于如何在堆内存中没有剩余空间状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文