Vasili Sviridov wrote:
> I see, but also there's no swap. So they can't get swapped out
> anywhere.

Here is single line from my `top` sorted by "VIRT" column:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND

26308 darkk     20   0 1025m  384  312 S  0.0  0.0   0:00.00 malloc


But `free` shows, that I use only 503mb of memory (running firefox,
thunderbird and some java apps) and I have swap turned off. I deduce
that "VIRT" has nothing common with real memory usage.

You can try yourself — here is code of `malloc`
==> malloc.c <==
#include <stdlib.h>
#include <stdio.h>
void main() {
  printf("%p\n", malloc(1 * 1024 * 1024 * 1024));
  sleep(600);
}

Run `gcc malloc.c -o malloc` to compile it.


> I'm not entirely sure about the allocation specifics, all i know is
> that when I kill the process - i get [VIRT] more free ram in my [Mem]
> bar.

What "bar" are you speaking about? Seems, that your "[Mem]" bar is
broken a bit.
/proc/meminfo is usually good source of information.

$ man top | grep -A 1 'RES.*--'
       q: RES  --  Resident size (kb)
          The non-swapped *physical* memory a task has used.

Yes, `man top` also says that "VIRT = SWAP + RES". It's not absolutely
correct. I've just shown the contrary.


-- 
WBRBW, Leonid Evdokimov

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to