Ios – Xcode – scribble, guard edges and guard malloc

iosiphonemacosxcode

Can someone explain what do these options in Xcode do?

  • Enable Scribble
  • Enable Guard Edges
  • Enable Guard Malloc

what they are and what they do and how useful can they be for debugging/testing?

thanks.

Best Answer

From the documentation.

  • Enable Scribble. Fill allocated memory with 0xAA and deallocated memory with 0x55.
  • Enable Guard Edges. Add guard pages before and after large allocations.
  • Enable Guard Malloc. Use libgmalloc to catch common memory problems such as buffer overruns and use-after-free.

Scribble will make it rather obvious that you're using a memory block after it's free'd by overwriting any data that used to be in the memory block upon free.
Guard edges and Guard Malloc will help you find memory overruns and (to some extent) use-after-free by read and write protecting memory blocks to make your program crash more obviously if misusing memory.