Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-19-2013, 09:39 AM   #1
Registered: Oct 2010
Distribution: Red Hat
Posts: 228

Rep: Reputation: 9
Unhappy Swap confusion from Top and Free Outputs

Hi All,

I am not sure how to put this and i am kind of feeling embarrassed also asking this question because i think i should have known this, anyways here it is.

# free -m
             total       used       free     shared    buffers     cached
Mem:          5834       4413       1421          0        436       2455
-/+ buffers/cache:       1521       4313
Swap:         2047          0       2047

12194 oracle    -2   0 2274m  16m  14m S  0.0  0.3   0:00.40 2.2g oracle
12198 oracle    15   0 2275m  17m  15m S  0.0  0.3   0:00.03 2.2g oracle
12192 oracle    15   0 2274m  17m  14m S  0.0  0.3   0:00.22 2.2g oracle
 4824 oracle    15   0 2275m  19m  16m S  0.0  0.3   0:00.46 2.2g oracle
Why there is a difference in the output, the server's swap usage is 0 so why Top shows the oracle swapping out 2.2g and more over how could that even be possible as the Total swap on the system is 2G.

I am sorry if there is something silly in the question.
Old 07-19-2013, 04:49 PM   #2
Registered: Feb 2008
Location: Sacramento
Distribution: RHEL AS, mostly
Posts: 44

Rep: Reputation: 18
The SWAP column in top shows VIRT minus RES and reflects the amount that might be swapped if the processes were to try to actually occupy all 2274m of the virtual address space. Since there are no pages allocated to the vast majority of that 2274m of mostly-empty virtual space, nothing needs to be swapped, and the free command rightly shows zero swap used.
Old 07-19-2013, 06:06 PM   #3
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Swapping activity is also not limited to the swap file/partition. It is entirely possible for the system to drop pages from memory where the program code hasn't been used, and page in other program code from the disk resident program file. This is an ambiguous report from top, as it defines swap this way (ref manpage on top):

p: SWAP  --  Swapped size (kb)
          The non-resident portion of a task's address space.
So a large executable is likely not entirely in memory - thus non-resident, and added to "swap size".
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Confusion Between Samba and Swap Partition hitmen Linux - Newbie 7 09-24-2011 07:48 AM
[SOLVED] PHP Outputs Metadata or File Information at the Top of its Output Hi_This_is_Dev Programming 3 09-10-2010 01:55 PM
Why doesnt top or free show swap memory usage ? exceed1 Linux - General 15 08-03-2009 09:38 PM
Swap space used: Why does free and top show different amounts compared to ps doublefrangelico Linux - Newbie 1 06-23-2009 02:50 PM
Swap CRT DVI outputs Kane2002 Linux - General 1 10-15-2006 08:15 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:36 AM.

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