Search code examples
glibcmtracemalloc-history

mtrace + MALLOC_TRACE - disable buffering


how can I disable buffering on mtrace and output file with name from MALLOC_TRACE ??

the mtrace is started as:

$ cat libmtrace1.c
#include <mcheck.h>
static __attribute__((constructor)) void mtrace_install(void) {
    atexit(&muntrace);
    mtrace();
}
$gcc libmtrace1.c -fPIC -shared -o libmtrace1.so
$LD_PRELOAD=./libmtrace1.so MALLOC_TRACE=mtrace_log /bin/ls 

Solution

  • Hey. Just write youself an another mtrace-like plugin and install it using malloc_hook(3).