Search code examples
iosdebuggingxcode4memory-managementmalloc

What's the relation between malloc diagnostics and malloc related environment variables?


Here there's a list of environment variables about the malloc package:

  • MallocStackLogging
  • MallocStackLoggingNoCompact
  • MallocPreScribble
  • MallocScribble
  • MallocGuardEdges
  • MallocDoNotProtectPrelude
  • MallocDoNotProtectPostlude
  • MallocCheckHeapStart
  • MallocCheckHeapEach
  • MallocCheckHeapSleep
  • MallocCheckHeapAbort
  • MallocBadFreeAbort

Also, when I open the Diagnostics section of my project from XCode 4, I see that under Memory Management, there are

  • Enable Scribble
  • Enable Guard Edges
  • Enable Guard Malloc

So, I'm a little bit confused. Should these environment variables be used in combination with the diagnostics settings, or are these diagnostics settings a shortcut for enabling the environment variables listed above?


Solution

  • To my knowledge they're shortcuts to the most common options; to use the others you need to set with environment variables.