Re: Linux: how to reclaim memory

On Jun 24, 9:57 am, Juha Laiho <Juha.La...@xxxxxx> wrote:
"lihao0...@xxxxxxxxx" <lihao0...@xxxxxxxxx> said:

Hope it's not OT. I ran a big SQL query last week and during that
period, that process ate up most of my memory plus some SWAP(about
1.4GB). the process finished last weekend, but it seems that the
memory used has not yet been released. a simpe 'top' command line
Cpu(s):  0.1%us,  0.0%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,
0.0%si,  0.0%st
Mem:   3977216k total,  3949516k used,    27700k free,    38040k
Swap: 33551744k total,  1369880k used, 32181864k free,  2230772k

   `sar -r` shows 1369880(1.3GB) 4.04%swpused     [usually it's

But I am not running any big programs on my machine right now. why
there are still such big SWAP in used. Is there any way to reclaim the
memory so that I don't have to use SWAP??

Pages will come back from swap when someone requests them. At this
moment, your operating system seems to consider it more economic to
use the available RAM as disk cache than to being unneeded application
memory pages back from the swap.

So, your system is in an extremely normal and good state. There's
nothing wrong in using swap (even continuously). If there was constant
(and high) activity of swapping pages in and out, then you would have

you are right. I want to clean up this SWAP space just because I use
'top' to monitor my system, and dont want this big number to hide some
potential RAM problems.:)

a problem. What I do find a bit strange is that you allocate such
a huge amount of good disk space as swap (could be needed, if you
have occasional, _huge_ memory needs), and then be upset by the fact
that your system decides to use one twentieth of that allocated space.

actually, there is 16GB RAM, not sure why `top` showed only about
4GB..the SWAP is twice in size than RAM. sounds OK to me.. :)


Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


Relevant Pages

  • Re: PBKDF2 preventing memory attacks
    ... If you have access to the content of the RAM (like to swap files), ... You need to pin the memory so it can't swap. ... If you already have a hash function that you've arranged ...
  • Re: OT (slightly) swap limits
    ... influence your decision on how much swap was enough. ... processes due to lack of memory. ... I've run machines with 1Gig or more RAM with NO SWAP. ... Linux possible when before on Unix it wasn't? ...
  • Tuning kern.maxswzone
    ... RAM, so I figured a low memory problem was wedging something, and the ... insurance and a heavily loaded sever might have 4x as much swap as RAM. ... messages at boot that state "warning: ...
  • Re: fedora-list Digest, Vol 10, Issue 167
    ... Well, I have two 433 MHz Celerons and 288 MB RAM, and no performance ... > The memory usage is always around 400MB. ... I'd like to introduce you to the vmstat command. ... > I know that SWAP should be double the Physical RAM but I don't have ...
  • Re: PBKDF2 preventing memory attacks
    ... If you have access to the content of the RAM (like to swap files), ... You need to pin the memory so it can't swap. ... their specific syntax, than random-looking symmetric keys. ...