16 Sep 2000 mjs   » (Master)

memory

It seems most people don't know how to measure a program's memory usage. Doing a ps and looking at SIZE or RSS totally does not cut it.

Here's how to do it right (in my opinion):

First you need to make sure your system is relatively quiescent, and memory load won't be randomly jumnping around. Now run `top'. Look at the memory and swap free. Record these numbers.

Now run the program you want to check. Keep watching `top', and see what the numbers settle at. Compute the difference. This is the only real way not to be fooled by thinks like shared libraries, buffers, mmap'd I/O, memory shared by multiple kernel threads that show separately in ps, other sorts of shared memory...

Of course, this only measures one prorgram. If shared libraries are getting used a lot, it's best to measure a set of programs meant to be used together all at once, since a lot of memory will be shared between them. This is the major blunder a lot of people make. Measuring one program that uses lots of shared libraries, if you are going to use any of the others, penalizes the program unfairly for being a good code reuse citizen.

life

I think I have gotten infected with the Advogato Malaise that has been going around lately.

tv

Bring out the Iron Chefs!

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!