LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-11-2009, 10:43 AM   #1
helpmhost
Member
 
Registered: Oct 2006
Posts: 43

Rep: Reputation: 15
Memory is not released after use?


Hi,

I have a virtual server with 512MB RAM. It is running CentOS 5.3 (with no GUI). It is a bare minimum install, only what I need is installed. It is still not in production, so no one is connecting to the server other than me.

After installing and starting all the server software, the server has about 200 MB of free RAM. Slowly after time, there is less and less RAM available. At one point there was only 5 MB available. When I do a ps -aux, there is very little memory being used by all the running processes. I ran an awk script to add up the %MEM column and it added up to 57%.

It seems like as memory starts getting used, it is never released or freed up. For example, I ran free and saw the amount of free RAM. Then I ran mysql client and made a quick update to 1 field and quit the client. The amount of free memory went down by 5 MB and never went back up.

I've tried restarting all the server software and it recovered about 40MB. However, if I restart the server, it goes back to about 220MB free. And once again, with time (and I repeat, no one is connecting to this server and using any processes) it goes back down to 20 or 30 MB free.

This is what is installed/running:
MySQL
Postfix (with MySQL support)
Dovecot
Spamassassin
Saslauthd
Daemontools
tjbdns
Apache with PHP (compiled from source with all modules disabled except a couple required ones)
OpenSSH

The first time it went down to 5MB, Apache + PHP were not installed yet, so I don't believe they are the cause.

I have a second server which is almost identical. The only different is that it isn't running daemontools and tjbdns, and it is not having this problem. However, all the daemontools and tjbdns processes are using 0.0% of MEM. This is also the first time I install daemontools and tjbdns.

Any ideas what might be happening? What can I do to troubleshoot/debug this?
 
Old 08-11-2009, 11:53 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
Any ideas what might be happening? What can I do to troubleshoot/debug this?
LQ is full of posts like this [Search for them]

linux uses RAM much more efficiently than windows. Ideally there should be no "free" RAM as "free" RAM is "wasted RAM" when it can be used for buffers to improve speed. If a process requests RAM that's not "free", then buffers will be flushed to give it the RAM it needs.

If you are not using swap, all is well.

Bottom line: Don't worry about it
 
Old 08-11-2009, 01:59 PM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Search, and don't worry about it until you start actively swapping.
 
Old 08-12-2009, 03:53 PM   #4
helpmhost
Member
 
Registered: Oct 2006
Posts: 43

Original Poster
Rep: Reputation: 15
Hi Thanks for the replies.

This still seems a little odd to me since all the other linux servers I've setup in the past have not done this. My concern is that when new memory is needed, it will not release the "unneeded used" memory. It would just make more sense to release the memory when it is no longer in use.

Anyways, I have left the server alone (in terms of watching the memory). I just checked again, and the free mem has kept going down, and it is now usinig 21MB swap. And this is still with no use (no connections to the server other than my ssh connection).

I have searched google and several forum sites (including this one) and I am not finding what I am looking for. What search terms would you recommend would find threads with an answer to this issue?

Thanks.
 
Old 08-13-2009, 01:06 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
As others have said, its not an issue unless you start thrashing (heavy usage of swap).
All the current versions of Linux use more-or-less the same kernel 2.6.xx, and most probably use the same scheduling/vm subsystems.
In essence, unused RAM is wasted RAM
Linux will cache as much as it can.
It WILL release those caches if it needs to.
It doesn't flush the RAM just because it's not being used, that would be unnecessary work; after all, if you don't need(!) it, why waste cycles flushing it?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory not released inaki Linux - Server 11 11-04-2008 01:20 AM
Two USB memory devies (stick memory/jump drive) one works one not Mark_in_Hollywood Linux - Hardware 5 05-20-2008 07:35 PM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
Help!?! RH 8 Memory Mapping -High Memory-Virtural Memory issues.. Merlin53 Linux - Hardware 2 06-18-2003 04:48 PM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration