通过循环中的malloc免费调用,AIX进程内存正在增加

通过循环中的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.