不知何故,此调用free()无效.我在Windows上运行此应用程序并在任务管理器中使用内存,但在调用后没有看到内存使用量减少free().
int main(int argc, char *argv[])
{
int i=0;
int *ptr;
ptr = (int*) malloc(sizeof(int) * 1000);
for (i=0; i < 1000; i++)
{
ptr[i] = 0;
}
free(ptr); // After this call, the program memory usage doesn't decrease
system("PAUSE");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
Tho*_*thy 13
典型的C实现不会返回free:d内存到操作系统.它可以由同一程序使用,但不能供其他程序使用.
| 归档时间: |
|
| 查看次数: |
379 次 |
| 最近记录: |