xfce4-panel & memory cunsumption

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Mon Sep 11 22:43:45 CEST 2006


Benedikt Meurer wrote:
> Numbers don't mean anything if you are unable to interpret them
> appropriately.

As an example, consider the following simple program:

---
#include <sys/types.h>
#include <unistd.h>

int
main (int argc, char **argv)
{
  void *addr;

  addr = sbrk (1000 * 1024 * 1024);

  for (;;) { sleep (1); }

  return 0;
}
---

That'll increase the heap area by 1GB and do nothing (the famous
while-do-nothing-loop). Oh my god, my program consumes 1GB of RAM!

For the kernel the heap is now 1GB writable memory (plus a few bytes of
writable data sections for the runtime link editor, relocations, etc.).
But is any of these pages assigned a physical page? Most probably not
(on modern systems). So what does the number 1GB for heap tells us?
Right, nothing.

http://foo-projects.org/~benny/tmp/test-mmaps.png

See, numbers without knowledge are irrelevant.

Benedikt



More information about the Xfce mailing list