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.