Sponsored Content
Top Forums UNIX for Advanced & Expert Users Linux Virtual Memory Question Post 302560486 by Corona688 on Friday 30th of September 2011 01:44:58 AM
Old 09-30-2011
Quote:
Originally Posted by jlliagre
You might be confusing with allocated memory.
Virtual memory as reported by top is the sum of memory present either on disk (mostly SWAP) or on RAM (RES).
I beg to differ:

Code:
$ cat megaalloc.c
#include <stdio.h>
#include <unistd.h>

int main(void)
{
	sbrk((1024L*1024L*1024L));
	while(1);
}
$ gcc megaalloc.c
$ ./a.out

Code:
top - 17:46:55 up  6:12,  4 users,  load average: 0.24, 0.17, 0.11
Tasks: 127 total,   2 running, 124 sleeping,   0 stopped,   1 zombie
Cpu(s): 45.5%us,  3.5%sy,  0.0%ni, 48.2%id,  0.3%wa,  2.5%hi,  0.0%si,  0.0%st
Mem:   3797432k total,  3236628k used,   560804k free,   161272k buffers
Swap:  2104476k total,        0k used,  2104476k free,  1373932k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
10599 monttyle  20   0 1027m  296  228 R   73  0.0   0:02.19 a.out              
 3825 root      20   0  748m  82m  10m S    8  2.2  25:52.57 X                  
10017 monttyle  20   0  149m 8032 5936 S    8  0.2   3:49.15 mplayer            
 9712 monttyle  20   0  220m  15m  10m S    5  0.4   4:38.51 gnome-terminal     
 5988 monttyle  20   0 1591m 1.3g  26m S    3 37.0  52:49.71 firefox-bin        
 9710 monttyle  20   0 71692  13m 4900 S    2  0.4   3:03.59 wish               
 5256 monttyle  20   0  216m  14m  10m S    1  0.4   2:54.01 metacity           
    8 root      20   0     0    0    0 S    0  0.0   0:10.05 events/1           
  453 root      20   0     0    0    0 S    0  0.0   1:20.78 kondemand/1        
 5278 monttyle  20   0  346m  23m  15m S    0  0.6   4:30.59 gnome-panel        
    1 root      20   0  3892  620  516 S    0  0.0   0:01.42 init               
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd           
    3 root      RT   0     0    0    0 S    0  0.0   0:00.06 migration/0        
    4 root      20   0     0    0    0 S    0  0.0   0:00.42 ksoftirqd/0        
    5 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/1        
    6 root      20   0     0    0    0 S    0  0.0   0:02.82 ksoftirqd/1        
    7 root      20   0     0    0    0 S    0  0.0   0:07.20 events/0

My process certainly does not have 1027M resident. It doesn't have it on disk, either -- having not used any of that gig of ram, none of it is actually paged in, resident, or even backed in any form. Other systems might demand sufficient swap to back it but not Linux, which by default has virtual swap.

On a 64-bit system you can also inflate that value by plunking in your entire hard disk as a memory segment via mmap. 300G virtual. I suppose that would count as on disk though.

Last edited by Corona688; 09-30-2011 at 02:50 AM..
 

10 More Discussions You Might Find Interesting

1. News, Links, Events and Announcements

Linux Virtual Memory Book

. (0 Replies)
Discussion started by: Driver
0 Replies

2. Shell Programming and Scripting

get physical and virtual memory

What command can i use to get the physical and virtual memory of a database? (7 Replies)
Discussion started by: tads98
7 Replies

3. UNIX for Dummies Questions & Answers

virtual memory

Hi, can anyone explain me what virtual memory is ( for which we use vmstat commande line ) comparing with RAM ? many thanks before. (2 Replies)
Discussion started by: big123456
2 Replies

4. Programming

about virtual memory and memory leak

Hi, First of all I appreciate this group very much for its informative discussions and posts. Here is my question. I have one process whose virtual memory size increases linearly from 6MB to 12MB in 20 minutes. Does that mean my process has memory leaks? In what cases does the... (4 Replies)
Discussion started by: shriashishpatil
4 Replies

5. HP-UX

Virtual Memory

Hi! I work with HP-UX and I have to monitorize the use of virtual memory for different processes. (java processes for Tibco Adapter) And if these processes exceed a limit send a message to the syslog. I donīt know how to monitorize this... Should I do a script? or use an aplication, for example... (3 Replies)
Discussion started by: Kurohana
3 Replies

6. AIX

ulimits max locked memory virtual memory

Hi, Would any one be so kind to explain me : are ulimits defined for each user seperately ? When ? Specialy what is the impact of : max locked memory and virtual memory on performance of applications for a user. Many thanks. PS : this is what I can see in MAN : ulimit ] ... (5 Replies)
Discussion started by: big123456
5 Replies

7. UNIX for Dummies Questions & Answers

cpu, memory and virtual memory usage

Hi All, Does anyone know what the best commands in the UNIX command line are for obtaining this info: current CPU usage memory usage virtual memory usage preferably with date and time parameters too? thanks ocelot (4 Replies)
Discussion started by: ocelot
4 Replies

8. UNIX for Dummies Questions & Answers

Virtual Memory

Hi, Can anyone please help me workout how much virtual memory I have running on a T2000 running Solaris 10. Thanks # df -h swap 3.5G 1.0M 3.5G 1% /etc/svc/volatile swap 3.5G 208K 3.5G 1% /tmp swap 3.5G 56K ... (2 Replies)
Discussion started by: jamba1
2 Replies

9. UNIX for Advanced & Expert Users

What is the function to get address of the virtual memory block in linux??

I want address of current virtual memory block? i am using fedora10:wall::wall: (1 Reply)
Discussion started by: powyama
1 Replies

10. UNIX for Beginners Questions & Answers

Virtual Memory in UNIX

So, I would ask you a piece of advice about which books or titles could give me comprehensive information about virtual memory in UNIX. Especially, I would found out that virtual address translation corresponds structures of kernel! Thanks! (2 Replies)
Discussion started by: Fadedfate
2 Replies
volunroot(8)						      System Manager's Manual						      volunroot(8)

NAME
volunroot - Remove Logical Storage Manager hooks for rootable volumes SYNOPSIS
/usr/sbin/volunroot [-a | -A] OPTIONS
Specifies that all volumes on the system disk be converted back to UNIX disk partitions, not just the root and swap volumes, rootvol and swapvol. Forces removal of the private region unless it is the last one in the system. DESCRIPTION
The volunroot script can be used to restore the accessibility of the root, swap, and other file systems on the boot disk directly through disk partitions instead of through volume devices. The script also removes other changes that were made to enable booting of the system from the root volume, so that the system will boot with no dependency on the Logical Storage Manager. When used with no options, volunroot affects only the root and swap volumes, rootvol and swapvol. For volunroot to work properly, only one plex must exist for each of the affected volumes. This plex must be the one created by volrootmir or the original plex created when the root disk was encapsulated. This ensures that the underlying subdisks will have equivalent partitions defined for them on the disk. If these conditions are not met, the volunroot operation fails and none of the volumes are converted to disk partitions. The unwanted plexes can be removed using either voledit or volplex. SEE ALSO
volencap(8), voldiskadm(8), voledit(8), volintro(8), volplex(8), volrootmir(8) volunroot(8)
All times are GMT -4. The time now is 06:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy