Visit Jeremy's Blog.
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 06-23-2009, 10:55 AM   #1
LQ Newbie
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
Question Swap space used: Why does free and top show different amounts compared to ps

My basic need was to determine why one of our Java apps ran out of memory on a Red hat server.

This led me to try and determine the amount of memory used.

This of course, took me me further into investigating how much Physical RAM and Swap Space was used by the app and in general.

This is what I tried
I have run the free -mt command which shows that the OS uses 0k swap space and has 5gb free.

The top command shows that the OS has 128k swap space used and 5gb free

However when I run the ps aux command the VSZ column shows that the app uses 2626456 (not sure if this is bytes or kb but that's beside the point)

The confusing part is that the VSZ is different to the swap space shown in the first 2 commands. Shouldn't the swap space be the same or bigger than the VSZ for that app (or the same as the total for all apps VSZ)

My assumption is that VSZ=virtual Size=Virtual memory=Swap memory

Is there something about VSZ which I don't understand?
How do I reliably determine how much RAM and how much swap space a process is using?

Thanks in advance

Last edited by doublefrangelico; 06-23-2009 at 11:31 AM.
Old 06-23-2009, 01:50 PM   #2
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,868
Blog Entries: 27

Rep: Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163

Remember things are a snapshot not absolute thus changing.

excerpt 'man ps';

vsize VSZ virtual memory usage of entire process. vm_lib + vm_exe + vm_data + vm_stack

vsz VSZ virtual memory size of the process in KiB
(1024-byte units). Device mappings are currently excluded;
this is subject to change. (alias vsize).
1 members found this post helpful.


free, linux, memory, ps, ram, swap, top, virtual

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
Why doesnt top or free show swap memory usage ? exceed1 Linux - General 15 08-03-2009 08:38 PM
swap space does not show in df command surya_prakash Linux - Newbie 1 06-17-2009 10:47 PM
OOM kill of custom program despite plenty of free swap space VelocideX Linux - Software 3 05-06-2009 12:45 AM
Formating free space: WinXP pro and RH9 dualboot with free space on 3rd drive Vermicious Linux - General 2 03-22-2004 05:10 AM
Setup free space on /dev/hdc without screwing up /swap DavidPhillips Linux - General 4 06-24-2001 10:35 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:27 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration