My suggestion would also be to use sbrk() as it provides a high-water mark for the memory usage of the process.
Below is the function hiwm() I used on Linux (RedHat). MacOS X and Unix versions are straigthforward. Not sure about Windows. /Jean Brouwers #if _LINUX #include <malloc.h> size_t hiwm (void) { /* info.arena - number of bytes allocated * info.hblkhd - size of the mmap'ed space * info.uordblks - number of bytes used (?) */ struct mallinfo info = mallinfo(); size_t s = (size_t) info.arena + (size_t) info.hblkhd; return (s); } #elif _MAXOSX || _UNIX #include <unistd.h> size_t hiwm (void) { size_t s = (size_t) sbrk(0); return (s); } #elif _WINDOWS size_t hiwm (void) { size_t s = (size_t) 0; /* ??? */ return (s); } #endif -- http://mail.python.org/mailman/listinfo/python-list