# Memory usage



## Jaax (Nov 19, 2010)

Hi all,

I'd like to write a script to watch the memory usage under an user.

But what's different between VSZ et RSS when you use ps command ?

RSS is a resident size. Memory usage for a process at this time ?
VSZ is a virtual size. Memory usage for a process + shared lib + swap used ?

Thanks a lot


----------



## DutchDaemon (Nov 19, 2010)

See http://forums.freebsd.org/showthread.php?t=19147


----------



## Jaax (Nov 19, 2010)

Thank for your answer and for the link.

I go to read the post.


----------



## Jaax (Nov 21, 2010)

Hi all,

I read the post but i have a question.
When i count the number of process Apache and the sum of their resident memory, this value don't match with memory usage display by the command 'top'.


```
Apache : 19 process x 5296 rss = 100624 Ko resident memory ~ 100 Mo
```


```
$ top
[...]
Mem: 19M Active, 3440K Inact, 46M Wired, 28K Cache, 387M Free
Swap:
[...]
```

The system have juste 19 Mo of active memory.

Thank


----------



## DutchDaemon (Nov 21, 2010)

The Apache processes all share that memory, so don't multiply the values.


----------

