Link Search Menu Expand Document

gdb Cheat Sheet

Debugging Code

GDB

Memory Leaks

  • Glib - mtrace(): Enable tracing by calling mtrace() right on startup and set environment variable

    export MALLOC_TRACE=alloc.log
    

    and analyze the result log with

    mtrace [<executable>] alloc.log
    
  • Glib - Slice Allocation Checking

    export G_SLICE=debug-blocks
    
  • Valgrind

    valgrind --leak-check=yes <executable> [ [...]]
    
  • JVM - Verbose GC:

    -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/gc.log
    
  • JVM - jstat: