我有这个代码:
#include <malloc.h>
int main()
{
int x = 1000;
//~600kb memory at this point
auto m = (void**)malloc(x * sizeof(void*));
for (int i = 0; i < x; i++)
m[i] = malloc(x * sizeof(void*));
for (int i = 0; i < x; i++)
free(m[i]);
free(m);
//~1700kb memory at this point
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当程序启动时,内存消耗约为~600kb,当它结束时约为1700kb.是内存泄漏还是什么?