Operating System - HP-UX
1847182 Members
3360 Online
110263 Solutions
New Discussion

Re: A problem about memory management

 
fengxb
New Member

A problem about memory management

I encounter a problem when developing on HP-Ux V.11.23 platform. My machine has 4GB memory. The compiler is aC++/ANSI C B3910B A.06.05. My program have to alloc and free memory frequently. For example, process named Demo malloc 400MB above all. Then it free 300MB memory. By using TOP, we found the memory allocated for Demo was still 400MB. Until the process was killed, the memory was released. If the process is still alive, the 400MB cannot be allocated for other processes. Have any approch to resolve the problem?

Thanks in advance
1 REPLY 1
James R. Ferguson
Acclaimed Contributor

Re: A problem about memory management

Hi:

This behavior is expected. When you 'free' memory that you have 'malloc'ed, the memory is returned back to the heap for reuse by the process. The memory is *not* returned to the system at large until the process terminates.

Regards!

...JRF...