#!/usr/bin/env stap # Layer +2 of Python's memory handling (see Objects/obmalloc.c): probe process("/usr/lib/libpython2.6.so.1.0").function("PyObject_Malloc") { printf("PyObject_Malloc(%i)\n", $nbytes); } probe process("/usr/lib/libpython2.6.so.1.0").function("PyObject_Malloc").return { printf("PyObject_Malloc(%i) -> %p\n", $nbytes, $return); } /* probe process("/usr/lib/libpython2.6.so.1.0").function("PyObject_Realloc").return { printf("PyObject_Realloc(%p, %i) -> %p\n", $p, $nbytes, $return); } probe process("/usr/lib/libpython2.6.so.1.0").function("PyObject_Free") { printf("PyObject_Free(%p)\n", $p); } */ /* # Layer +1 of Python's memory handling (see Objects/obmalloc.c): probe process("/usr/lib/libpython2.6.so.1.0").function("PyMem_Malloc").return { printf("PyMem_Malloc(%i) -> %p\n", $nbytes, $return); } probe process("/usr/lib/libpython2.6.so.1.0").function("PyMem_Realloc").return { printf("PyMem_Realloc(%p, %i) -> %p\n", $p, $nbytes, $return); } probe process("/usr/lib/libpython2.6.so.1.0").function("PyMem_Free") { printf("PyMem_Free(%p)\n", $p); } */ /* # Layer 0 of Python's memory handling (see Objects/obmalloc.c): probe process("/lib/libc-2.11.so").function("malloc").return { printf("malloc(%i) -> %p\n", $bytes, $return); } probe process("/lib/libc-2.11.so").function("realloc").return { printf("realloc(%p, %i) -> %p\n", $oldmem, $bytes, $return); } probe process("/lib/libc-2.11.so").function("free").return { printf("free(%p)\n", $mem); } */