12 Nov 2002 fxn   » (Master)

For the comparative in my Perl seminar, I have been looking for a language independent way of measuring memory usage of a process in Linux different from time(1), but found no answer in IRC or Usenet.

The problem with time(1) in this Debian is that the M resource specifier returns always 0, which according to its man page means that it is not available. By the way, don't waste your time like me executing time -f format program and staring at the terminal like an idiot trying to understand why on earth you get the error bash: -f: command not found, swearing aloud that the man page says that should be a valid call, lighting candles and burning incense around the screen in case there are ghosts in the computer: Bash has a time builtin, so you need to call it as /usr/bin/time or whatever. My goodness.

The solution came yesterday night, I read in Perl Debugged that Unix processes only grow! On page 176 it says:

Note that the amount of memory allocated by a Unix process never decreases before it terminates; whenever it frees memory it makes it available only for the same process to reuse again later. (It is not returned to the free pool for other processes to use.)
I didn't know it! This is excellent news: Since we have the source code of the five programs measuring their memory usage is then as easy as calling ps(1) from within them before they exit. We've finally got the graph I missed in the presentation. Great!

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!