Operating System - HP-UX
1834625 Members
2618 Online
110069 Solutions
New Discussion

Memory management policy in HP-UX 11

 
Pallavi Dasgupta
New Member

Memory management policy in HP-UX 11

C routines malloc() and free()re being called to allocate and deallocate memory in application processes running on HPUX 11.t despite deallocation of memory the memory still remains attached to the process (Using top we find that the process size is growing).Can this be explained in the light of the memory menagement policy in HP-UX ?
Also is there a solution to this problem since our application will be doing this memroy intensive operations frequently.
3 REPLIES 3
Deepak Extross
Honored Contributor

Re: Memory management policy in HP-UX 11

Ravi_8
Honored Contributor

Re: Memory management policy in HP-UX 11

Hi,

brk() and sbrk() could help u
never give up
Rick Beldin
HPE Pro

Re: Memory management policy in HP-UX 11

This is by design. Asking the OS the expand and contract the memory associated with your process is expensive, so the freed memory is 'cached' within the process. This makes for a faster malloc() the next time through, since libc doesn't have to do a system call to collect the memory, but just traverse the freed memory within the process.

While you can use brk() and sbrk() to do this, you probably ought not to use them will malloc(). You may actually see some performance degradation as you start to ask the OS to more for you.

Better options might be to look into the mallopt() call to change how the memory allocation algorithms work. One technique might to be make larger initial allocations.


In the devresource.hp.com, there is this article:

http://h21007.www2.hp.com/dspp/tech/tech_TechSingleTipDetailPage_IDX/1,2366,307,00.html

Necessary questions: Why? What? How? When?