LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-20-2008, 01:01 PM   #1
aznblood
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Rep: Reputation: 0
Top shows virtual memory use by proccess more than physical RAM! help!


I developed an application and my process memory used (shown in top) is more than my RAM memory given that I do not use any disk swap memory. Can this be possible. Here is an illustration:


Free mem in Kbs: shows that i have 118megs of physical memory on PC

total used free shared buffers
Mem: 118648 61824 56824 0 3204
Swap: 0 0 0
Total: 118648 61824 56824


------------------------------------------------------------------------------

memory used by application : application uses 150megs of memory

Load average: 0.81 0.77 0.71
PID USER STATUS VSZ PPID %CPU %MEM COMMAND
22018 root S 150M 3244 0.1130.1 xpod

-------------------------------------------------------------------------------

Memory status of application:

State: S (sleeping)
SleepAVG: 98%
Tgid: 22018
Pid: 22018
PPid: 3244
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 256
Groups:
VmPeak: 155552 kB
VmSize: 154528 kB
VmLck: 0 kB
VmHWM: 3744 kB
VmRSS: 3744 kB
VmData: 150372 kB
VmStk: 84 kB
VmExe: 664 kB
VmLib: 2844 kB
VmPTE: 88 kB
Threads: 13


Question: Why is my application using 150megs of memory while I only have 128megs of ram on my computer total?

Thank you
 
Old 08-21-2008, 08:23 AM   #2
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
hi,

sometimes tht happens when I try to install some latge packages on my 128MB machine too. I feel tht this is the virtual memory or perhaps the swap tht is being used. I do not know for sure. Just a guess
 
Old 08-21-2008, 10:19 AM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Quote:
Originally Posted by aznblood View Post
my process memory used (shown in top) is more than my RAM memory given that I do not use any disk swap memory. Can this be possible.
Not just possible, it is normal and common.

1) A large fraction of the executable code and the read only data defined in executable files and .so's will be backed by the original files rather than the swap space.

So the executable file and the .so's are in the process's virtual memory, but much of that may not be in physical memory, nor in swap space.

2) Virtual memory can be shared. If you total the virtual memory use over all processes, you get a number at least as large as the actual total virtual memory use for the system, but maybe much larger (if there is a lot of actual sharing).

Top tells you how much of each process's virtual memory is shareable, so you could total the virtual memory, subtract the total shareable and add back the shareable part from the single process with the largest shareable part.

With some obscure exceptions, that would give you a lower limit on the actual total virtual memory use. If that lower limit is not too far below the upper limit you get be just totaling the virtual memory for all processes, then you have an idea of the total virtual memory for the system.

Otherwise, so far as I understand, there is nothing to tell you an accurate total virtual memory. One method over estimates by not measuring sharing, the other under estimates by not really measuring sharing. Nothing accurately measures virtual memory sharing.

3) There are also various demand writable classes of memory. "Copy on write" memory represents memory that is not technically shareable, but is in fact shared until it is written to. A process may have significant amounts of copy on write memory that it could write to but hasn't. I don't know whether top reports that as shareable.
"Demand zero" memory is sections of memory that exist only as virtual memory, without existing anywhere as physical memory nor backed anywhere on disk. To the extent that I understand the stats you posted, I think most of the missing memory is demand zero. This occurs when the application allocates a large chunk of address space but hasn't used it yet.

Quote:
Originally Posted by aznblood View Post
Question: Why is my application using 150megs of memory while I only have 128megs of ram on my computer total?
The significant question is why did your application allocate 150MB of address space for data when it is using much less than half of it.

If it allocated on startup a reasonable estimate of memory it is likely to need later, then it will crash when it actually tries to use that memory, because that memory is over committed (not backed by any physical resource).

Last edited by johnsfine; 08-21-2008 at 10:34 AM.
 
  


Reply


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
Physical Memory and Virtual Memory Murdock1979 Linux - General 1 01-28-2008 08:35 AM
how can i run 3 linux virtual machines without going out of physical memory asterik123 General 7 04-14-2007 06:51 PM
Memory Mapping (same physical address = virtual address) skd.tech Linux - Kernel 7 07-25-2006 12:13 AM
Firefox gets stuck... top shows 98-99% memory usage amitsharma_26 Linux - General 26 12-28-2005 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:15 AM.

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