Operating System - HP-UX
1753779 Members
7279 Online
108799 Solutions
New Discussion юеВ

Re: Howz Memory management in HP-UX

 
ASR
Contributor

Howz Memory management in HP-UX

Any body can answer memory allocation strategy on hp-ux. I able to see the below behaviour on hp-parisc 11.11. I am using g++ compiler.

1.) Memory is allocated (malloc) and cleared (free). If you now take a look at the memory usage of the process the whole memory allocated is still in use of the process. The memory doesn't seem free.
2.) If I allocate and free the same amount of memory always the memory used by the process increases once and stays stable afterwards.
3.) If I change the allocation size every time the memory usage is always increasing.

3 REPLIES 3
T G Manikandan
Honored Contributor

Re: Howz Memory management in HP-UX

James R. Ferguson
Acclaimed Contributor

Re: Howz Memory management in HP-UX

Hi:

This behavior is what you would expect to see. The "heap" is the process's memory pool. Calls to 'malloc()' and its cousins add to the heap up to the 'maxdsiz' kernel limit for a process. A 'free()' deducts the allocated memory from the heap but does not disassociate the memory from the process as long as the process is running.

For a 32-bit process, the kernel's 'maxdsiz' defines the maximum size to which the head can grow. For a 64-bit process, the 'maxdsiz_64bit' parameter controls the size. The "d" denotes "data" as opposed to the stack or the program text (instructions). These too have limitations; the 'maxssiz' and 'maxssiz_64bit' for the stack; the 'maxtsiz' and 'maxtsiz_64bit' for text.

Regards!

...JRF...

Re: Howz Memory management in HP-UX

As JRF has indicated, this is exepected behaviour - it's done as a perfromance trade-off, in that the performance cost of releasing and re-organising memory to avoid hideously complex fragmentation is usually more expensive that just holding on to the memory.

Don't worry though, if your process ever comes under severe memory pressure, then vhand will be picking out those pages in the heap which have been released by the program through a call to free as candidates for page-out. So when the system gets under memory pressure, you do get vthat memory back.

Is this actually a problem for you? Or just an observation?

HTH

Duncan

I am an HPE Employee
Accept or Kudo