标签:内存泄露
安装#include <stdio.h>
#include <stdlib.h>
int*Test(void)
{
int* x = malloc(10 * sizeof(int));
delete x;// problem 1: heap block overrun, problem 2: memory leak --x not free, only first address
return x;
}
int main(void)
{
int count;
Test();
printf("i =%d/n", count); //problem 3: use uninitialised value.
return 0;
}
标签:内存泄露
原文地址:http://blog.csdn.net/zjufirefly/article/details/42146483