在AIX上,VSZ和RSS不断增加
VSZ and RSS kept increasing on AIX
在AIX上运行我的应用程序时,我看到一个异常的内存使用模式…
我已经创建了一个简单的程序来malloc和自由复制相同的问题。
int main()
{
int *ptr_one;
// enter value as 0.
// I wanted few secs fetch the PID of this statndlone process
// and run 'ps -p <PID> -o "vsz rssize"'
long a;
scanf("%ld", &a);
for(;;)
{
if(a < 10000000) a = a + 100;
ptr_one = (int *)malloc(sizeof(int)*a);
if (ptr_one == 0){
printf("ERROR: Out of memoryn");
return 1;
}
*ptr_one = 25;
printf("%dn", *ptr_one);
free(ptr_one);
}
return 0;
}
我使用下面的命令
捕获了这个程序的内存使用情况ps -p $1 -o "vsz rssize" | tail -1 >> out.txt
图显示内存一直在增长,没有释放。这是泄漏的迹象,还是AIX上的正常内存行为?
进程的内存使用大小没有减少是完全正确的:虽然malloc
可以为进程请求额外的内存,但free
永远不会将其返回给系统。相反,释放的内存在以后的malloc
调用中重用。
相关文章:
- 数组索引的值没有增加
- 为什么我的代码在输出中增加了93天
- 不断收到相同的错误...怎么了?C++
- 有效地使用std::unordered_map来插入或增加键的值
- Vulkan验证层不断在VkQueuePresentKHR()上抛出图像布局错误
- ActiveMQ使用者的内存使用量在onMessage调用后不断增加
- 不断增加的指针数组 错误:赋值中的类型不兼容
- 我的值不断增加,而不是在循环语句中重置
- C++不断增加阵列大小
- 当使用动态数组时,循环中的内存使用量不断增加.(C++)
- 随着C++程序的运行,内存使用量不断增加
- Arduino Serial.available() 不断增加
- gtkmm应用程序内存使用量不断增加
- 不断增加物理内存Visual c++ CryptMsgClose和CryptReleaseContext
- 在AIX上,VSZ和RSS不断增加
- 共享内存访问导致rss增加
- 信号量句柄的数量不断增加
- 尽管初始大小固定,但用于跟踪对象的边界框/ROI 的大小仍在不断增加
- Linux:为什么 smaps 中的值会不断增加
- c++ -不断增加一个整数