Ram Usage

Hi
one of our applications that runs on our Linux server leaks memory resulting in Ram that was used by the program not being released back to the operating system once a file has been processed. the result is over a very short period virtual all the memory has been used. an example currently

Mem:  32434444k total, 29335644k used,  3098800k free,  1122280k buffers
Swap: 16779884k total,      508k used, 16779376k free,  7974532k cached

Question: Is there a way of reseting the Ram without rebooting the server?

Thanks
Treds

Can be ipcs, ipcrm command help you.

Can you post the output of

free -m

please?

It is possible to flush caches without a reboot but afaik not working segments.

Actually, please post the output of this:

vmstat -s -S M | egrep "mem|swap"

Also, realize that Linux, as well as many other operating systems, will cache files read in memory for performance reasons. Should another application require more memory, that file cache will be discarded to provide adequate space for the new application.

If you are swapping in the few hundred KB, don't worry. That is fine.

# vmstat -s -S M | egrep "mem|swap" 
31674 M total memory
29436 M used memory
15296 M active memory
12051 M inactive memory
2237 M free memory
1106 M buffer memory
6902 M swap cache
16386 M total swap
0 M used swap
16386 M free swap
0 pages swapped in
1 pages swapped out

treds,

You have plenty of memory available. You are not swapping and have plenty for applications.

Yes there is still plenty of memory but going back to my original question
the Ram just keeps being taken and not released due to a issue with one of our applications. The only way to get all the ram back as free is to reboot the server,
which is something i don't want to do. is there any way to reset without rebooting?
thanks
Treds

My point to you before was, that it is likely that your RAM is NOT being gobbled up by this application. I don't mean you have a lot of "overall" RAM. I maean you have quite a bit available in a cached state that can be cleared to make way for applications. Unless you begin swapping pages out, this is caching and nothing to worry about. You SHOULD be using all the memory. That is what Linux does.

Unless this is a very poorly coded application or a JAVA application with poor garbage collection and heap size allocation you have little to worry about. What line in particular are you worried is a problem?

Tell me what lines in either free or the command I gave you are concerning you.

Memory leaks is indeed a bad thing and can be trick to find BUT if you used a tool like collectl it would certainly make things a lot easier. Similar in function to SAR but with much more comprehensive data collection and reporting. Since leaks can often be slow, you'd probably want to postprocess the data it collects rather than run it in real-time, so just turn it on and let it do its thing for awhile.

Then you can play back the data and examine the top users of memory by process! In fact if you do see your process using up real memory and that memory happens to be slabs, you can actually look at the top slab being consumed over time too! While the latter view is not by process, it can provide get hints to the problems since the slab names tend to tell you why that memory is being used.

-mark