Operating System - HP-UX
1833390 Members
3022 Online
110052 Solutions
New Discussion

Re: process memory usage in 10.x machine

 
SOLVED
Go to solution
dheepak
Occasional Contributor

process memory usage in 10.x machine

I understand that when i use "delete" operator call or free() call in c++, i'm releasing memory from the process to the operating system(HP 10.20).
But why does Glance doesnt show the decrease in process memory usage .
even "top" command doesnt reflect the change in the mem. usage of the process?

how much i know depends on how little you know
2 REPLIES 2
harry d brown jr
Honored Contributor
Solution

Re: process memory usage in 10.x machine

Because it really doesn't. Part of the schedulers task is to help the system determine what the high and low memory requirements are per process. That way, when/if the process starts to demand more memory, it will already have it reserved. But if the system needs to "reclaim" it, it will.

http://docs.hp.com/hpux/onlinedocs/os/11i/mem_mgt.html

live free or die
harry
Live Free or Die
A. Clay Stephenson
Acclaimed Contributor

Re: process memory usage in 10.x machine

Hi:

I can't believe I just answered the same question.

When you free process memory using free(), the memory is not returned to the OS but rather goes back on the process's heap forereuse by the same process. You can use the sbrk() system call with a negative vaue to decrease allocated process space but this is not for the faint of heart. If you use sbrk(), you must not use any of the higher-level memory allocation/free functions or absolute chaos including crashes is almost guaranteed.

Regards, Clay

If it ain't broke, I can fix that.