Enable Guard Malloc

April 18, 2009 § Leave a comment

In Xcode, you can select “Enable Guard Malloc” under Run menu. It will verify if you overrun the out of bounds of a heap allocated memory block.

Under Project menu select “Edit Active Executable”, select “Arguments” tab to add the following to the environment variables section.

NSAutoreleaseFreedObjectCheckEnabled: Yes
NSZombieEnabled: Yes
NSDebugEnabled: Yes

If you check the boxes, Xcode will check autorelease and release showing a more in depth stack trace. NSZombieEnabled is an environment variable that request runtime to use “zombie” objects. These objects step in the place of deallocated objects and any messages sent to these objects will be logged. It helps to track any deallocation issues. Note: it will show nothing if your code is good.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

What’s this?

You are currently reading Enable Guard Malloc at Web Builders.


%d bloggers like this: