1837111 Members
2029 Online
110112 Solutions
New Discussion

memory problem

 
SOLVED
Go to solution
szhiyong
Frequent Advisor

memory problem

Hi,

I have one software which uses 400MB memory. I found a tricky problem in my memory. Befor I run the software, I check the memory statistics:
statis total used avail %used
physical 768 145 622 19%

I run the program for two days. Then I kill the program. I check the memory statistics again, it changed a lot:
statis total used avail %used
phyiscal 768 460 307 60%

Would someone please tell me why this happens?

Thanks a lot!!

zhiyong
My life is now asking and learning, I wish It can change into replying and discussing
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: memory problem

This could be perfectly normal or you could have a memory leak. There is not enough data to determine this. The program could be allocating memory to gradually expand the amount of data it caches up to some limit; in this case, it might reach equilibriunm and stop
growing OR it could be allocating memory and not freeing it; there is simply no way to know at this point.

You could use Glance to monitor the processes memory use or you could use this sar command:
UNIX95= ps -e -o "user,vsz,pid,ppid,args"|sort -rnk2|more

If you know the PID you are interested in, you could restrict the ps command using the -p argument.



If it ain't broke, I can fix that.
Shannon Petry
Honored Contributor

Re: memory problem

First guess is that your program has what is commonly called a memory leak.
Is this your code? or a vendors?
There is a program called tusc (like the common truss) for HP-UX which will show you all the calls a program makes. There is also a utility shmem which will show you what is occupying what ranges in memory. Dont worry about these tools if it is vendor code your running, but contact the vendor to have their code fixed.
If this is your code, you will have to sift through and see where you may illegally be dumping off memory. Windows has taught people that sloppy memory management in code is okay, cuz the OS cant manage memory anyway. Good coding says for every malloc() there is a dmalloc().

Regards,
Shannon
Microsoft. When do you want a virus today?
Sajid_1
Honored Contributor

Re: memory problem

Hi,

The best thing I would do is to check the system memory usage with GlancePlus. You can easily find out a memory leakage with this tool. Find out the process usage, memory and CPU usage. Apply any patches if necessary to solve the issue.

hth,
learn unix ..
szhiyong
Frequent Advisor

Re: memory problem

Hi,

Thanks a lot.

I will use glance to check if there is memory link.

zhiyong
My life is now asking and learning, I wish It can change into replying and discussing