Published August 11th, 2009

I can never remember all of the options for malloc(3) on OSX when debugging. So I’m posting it here so I can find it with Google Search next time I need to find it:

export MallocLogFile=/tmp/malloc.log
export MallocGuardEdges=1
export MallocStackLogging=1
export MallocStackLoggingNoCompact=1
export MallocPreScribble=1
export MallocScribble=1
export MallocCheckHeapAbort=1
export MallocBadFreeAbort=1
ulimit -c unlimited

similar malloc debugging for linux:


related: memcheck. and more info on the suse wiki.

Written by Paul Querna, CTO @ ScaleFT. @pquerna