通过循环中的malloc免费调用,AIX进程内存正在增加 [英] AIX process memory is increasing with malloc free calls in loop

查看:124
本文介绍了通过循环中的malloc免费调用,AIX进程内存正在增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在AIX 6.1上运行此代码

I am running this code on AIX 6.1

while(true)
{
    int a = rand(); //generate a random integer value
    void* test = malloc(a*a); //allocate large chunk of memory block
    usleep(3000000); //sleep for 3 sec 
    free(test); // release memory block
}


驻留集大小(实际内存)和用于处理的数据段大小正在不断增加。这是通过命令ps v PID
pg sp值检查的,该值在topas中显示为进程正在缓慢增加。

using MALLOCTYPE=buckets My observation is Resident set size(real memory) and data section size for process is continuously increasing. This is check by command ps v PID pg sp value shown in topas for process is slowly increasing.

有人可以证明这一点吗?行为。

Can someone justify this behavior.

推荐答案

免费地,内存不会释放到AIX os,但保留供重复使用。使用MALLOCOPTIONS = disclaim,可以将内存释放回AIX操作系统,并且不会增加内存利用率。但是使用MALLOCOPTIONS = disclaim,CPU使用率几乎提高了2-3倍。

On free, memory is not released to AIX os, but it is reserved for reuse. With MALLOCOPTIONS=disclaim, free releases memory back to AIX os and their is not increase in memory utilization. But with MALLOCOPTIONS=disclaim, CPU utilization is almost 2-3 times greater.

这篇关于通过循环中的malloc免费调用,AIX进程内存正在增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆