View previous topic :: View next topic |
Author |
Message |
Crisis l33t
Joined: 10 Feb 2003 Posts: 613 Location: Portland, OR
|
Posted: Fri Apr 16, 2004 7:44 pm Post subject: Why is swap being used? |
|
|
Seems I keep swapping out space even though mem is free:
Code: | total used free shared buffers cached
Mem: 89 73 15 0 12 23
-/+ buffers/cache: 38 51
Swap: 256 40 216 |
Any idea why? |
|
Back to top |
|
|
Anime_Fan Guru
Joined: 01 Jul 2003 Posts: 366 Location: Linköping, Sweden
|
Posted: Fri Apr 16, 2004 8:02 pm Post subject: |
|
|
Used memory isn't freed.
You probablt were using more memory than your RAM could handle at one point. Thus, it will say that you use(d) swap. |
|
Back to top |
|
|
Crisis l33t
Joined: 10 Feb 2003 Posts: 613 Location: Portland, OR
|
Posted: Fri Apr 16, 2004 8:39 pm Post subject: |
|
|
Is there any way to see the current swap usage?
Also, why would memory show as 89 instead of the 96 I have?
Thanks! |
|
Back to top |
|
|
Nate_S Guru
Joined: 18 Mar 2004 Posts: 414
|
Posted: Fri Apr 16, 2004 11:42 pm Post subject: |
|
|
the mem amount thing I think is the difference between "salesman's megs" and real megs showing up, 1000 vs 2^10=1024
I'd also like to know if you can see current swap usage. |
|
Back to top |
|
|
sapphirecat Guru
Joined: 15 Jan 2003 Posts: 376
|
Posted: Sat Apr 17, 2004 1:35 am Post subject: |
|
|
Crisis wrote: | Is there any way to see the current swap usage? |
free is showing the current swap usage; stuff may have been pushed out to swap earlier and not used since, so the kernel sees no point in bringing it in. It can't see the future, so it can't tell whether it should swap stuff in, or whether some running process may want another 10 MB of RAM soon.
Quote: | Also, why would memory show as 89 instead of the 96 I have? |
The chunk of memory the kernel lives in can't be swapped out, so it won't show up as usable memory. _________________ Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%... |
|
Back to top |
|
|
speed_bump Tux's lil' helper
Joined: 10 Jan 2004 Posts: 92 Location: Wisconsin, USA
|
Posted: Sat Apr 17, 2004 1:57 pm Post subject: |
|
|
Another possible reason for seeing 89 megs instead of 96 may be that your video card is "sharing" memory with the system. That is, instead of having its own physical memory, the video card is using some of your system's memory. Your BIOS should tell you if that's the case. |
|
Back to top |
|
|
Souperman Guru
Joined: 14 Jul 2003 Posts: 449 Location: Cape Town, South Africa
|
Posted: Sun Apr 18, 2004 9:23 am Post subject: |
|
|
The "lost" memory is used by the kernel. As you can see, mine show 503 total instead of 512. I don't have onboard VGA which could share memory.
Code: |
root@desktop[pts/21]:/root# free -m
total used free shared buffers cached
Mem: 503 350 153 0 44 210
-/+ buffers/cache: 95 408
Swap: 980 1 978
|
_________________ moo |
|
Back to top |
|
|
speed_bump Tux's lil' helper
Joined: 10 Jan 2004 Posts: 92 Location: Wisconsin, USA
|
Posted: Sun Apr 18, 2004 5:19 pm Post subject: |
|
|
Another thing to be aware of (getting back to the original question) is that the kernel will try to keep a certain percentage of RAM free in order to mitigate possible thrashing and deadlock scenarios. So in small memory configurations, it's very possible to have swap used even though there is RAM available.
In general, the kernel will try to move pages to swap that have not been used recently so this isn't a big deal. However, "recently" is an vague term and on a very busy system "recently" might be on the order of seconds rather than minutes or hours.
Is this causing you problems? |
|
Back to top |
|
|
|