#include
void main(void)
{
char ptr = (char)malloc(10);
if(NULL == ptr)
{
printf("\n Malloc failed \n");
return;
}
else
{
// Do some processing
}
return;
}
为什么:
如果上面的代码处于一个“while循环”中,会导致严重的内存泄漏问题!
#include
void main(void)
{
char ptr = (char)malloc(10);
if(NULL == ptr)
{
printf("\n Malloc failed \n");
return;
}
else
{
// Do some processing
}
return;
}
为什么:
如果上面的代码处于一个“while循环”中,会导致严重的内存泄漏问题!