Celejar <cele...@gmail.com> writes:

> Your numbers are much too high.

Maybe it's because I've been more looking at the virtual memory that top
shows.  What's actually resident can be much less.  Still:


,---- [ top ]
|   PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND         
  
| 14529 lee       20   0 4755m 4.1g  12m S   1.3 52.9   1:27.93 gimp            
  
|  3956 lee       20   0 1794m 886m  56m S   4.3 11.1  10:29.61 seamonkey-bin   
  
|  5101 lee       20   0 1010m 866m  49m R  93.1 10.8  64:43.58 x3              
  
`----


That's gimp with a scan of a double-page of a paperback (a lot smaller
than an A4 page), converted to rgb colorspace after loading, my normal
seamonkey which I have pretty much always open and X3 running for a
short while.  I have "vm.swappiness=80" in /etc/sysctl.conf because I
rather have unused stuff swapped out than keeping it in memory.

X3 will go up to over 3GB virtual and, IIRC, about 1.2--1.5GB resident
if you play long enough.  (Don't buy it, it's got too many bugs.)


,----
| lee@yun:~$ free
|              total       used       free     shared    buffers     cached
| Mem:       8196628    8000492     196136          0      16412     877004
| -/+ buffers/cache:    7107076    1089552
| Swap:     62496764      69932   62426832
| lee@yun:~$ 
`----


With 2GB RAM, I do recommend having a lot more swapspace than only 4GB,
as well as with more RAM.  I know it doesn't really help you; what it
does is slowing the system down so /you/ can decide which process you
want to kill before the system makes the decision itself.

A couple days ago I talked to someone who had a 4GB laptop running
Ubuntu.  They had 250MB swap space.  It's a brilliant idea: If the disk
sustains 50MB/sec, it takes 5 seconds before the swap space is full and
the killing starts and the system may go down.  8GB swap space?  *If*
you are at the keyboard when it happens and *if* you are fast enough
with killing something ...  60GB?  Overdone, I guess, but I doesn't hurt
me, and it might take all night and I can kill something when I wake up.


If you want to play, compile the attachment with 'gcc -O2 mem.c -o mem'
and run something like './mem 20 20'.  That allocates 20MB and does
nothing with it and another 20MB it fills with char 58.  That will show
that you can basically allocate as much memory as you want as long as
you don't use it without anything happening and that the system will
start swapping when you allocate enough RAM *and* use it.

You can try to bring your system down with that, just allocate enough
memory and wait for a critical process to be killed.  I've made such
experiments 16 years ago and it worked :)


Attachment: mem.c.bz2
Description: Binary data


-- 
Debian testing amd64

Reply via email to