0

I am attempting to debug a standard run-of-the-mill "incorrect checksum for freed object - object was probably modified after being freed" memory issue in my application. I'm pretty familiar with the tools to find the cause (guard malloc, etc.) and have successfully done so in the past in the XCode UI.

However the issue I am having is that this memory issue only occurs in the build created by the xcodebuild command line tool, so I cannot use the XCode UI checkboxes. I tried setting the checkboxes (in the scheme under Diagnostics->Memory Management) and see the effect (very slow performance) when I run my program via Xcode UI, but unfortunately the issue never occurs here. Then I go back and run my program from the xcodebuild-built binary and the issue occurs, but the performance is back to normal meaning none of the UI flags got used during this build.

I tried to set a few environment variables before running my program, i.e.:

MallocGuardEdges=YES
NSZombieEnabled=YES
MallocScribble=YES 

But there is still no effect to my xcodebuild-built binary when I run it from the command line.

The apple documentation seems to imply my program needs to be built with GuardMalloc library support, but when I built my program using xcodebuild after setting the checkboxes in the XCode UI there was no different in size, so maybe I need to change a setting somewhere else in order to add that support to my binary?

Update: Corrected commands to set environment variables.

Locksleyu
  • 5,192
  • 8
  • 52
  • 77
  • The fact that it only occurs when built from the commandline suggests that you're building a different configuration. The default configuration from xcodebuild is Release. Have you tried building under Release in Xcode to see if the issue occurs? Then you don't need to worry about the above. Also, do you have a typo in the above with "set env?" What exactly are you typing? – Rob Napier May 31 '12 at 14:08
  • Rob, thanks for the comment. I fixed the 'set env' mistake above to reflect exactly what I am typing in the terminal. I have tried both building both the Release and Debug builds with both the UI and XCodeBuild, and Release/Debug doesn't matter. The issue only occurs in builds built via XCodeBuild. – Locksleyu May 31 '12 at 14:17

0 Answers0