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
shows:
===============================================================
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
buffers
Swap: 33551744k total,  1369880k used, 32181864k free,  2230772k
cached
----------------------------------------------------------------------------------------------------

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

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.. :)

lihao

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 ...
    (sci.crypt)
  • 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? ...
    (Debian-User)
  • 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: ...
    (freebsd-stable)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... >> memory and hence causes the kernel to 'thrash' thus slowing down the ... 4GB physical RAM + 4GB swap area) the application will think that it can ... You've said in another message that your app is ...
    (comp.os.linux.setup)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... >> memory and hence causes the kernel to 'thrash' thus slowing down the ... 4GB physical RAM + 4GB swap area) the application will think that it can ... You've said in another message that your app is ...
    (comp.os.linux.misc)