appCode vs xCode build outputs - chasing a (pseudo?) memory leak

Hello all, I have been chasing a memory issue that shows up when i compile with xCode5 and in the Allocations instrument.  (see http://stackoverflow.com/questions/19234526/constant-app-memory-increase-ioaccelresource) . It does not register as a leak with the Leaks instrument, but i guess 1Mb per 2 minutes would qualify imnsho. The only reason i am using xThingie at the moment is that i'm prepping to submit to the AppStore, and i'm playing certificates and Archive. I completely missed that leak while running down my test suite with AppCode because it is not there !!!   when i compile and run Instruments from AppCode 2.1.2, the leak is NOT there.

Also, the memory footprint is 50% higher with the xCode build vs AppCode. So my question basically, even if i use the same scheme/target, .xcodeproj file, etc etc etc .... does AppCode do anything different at compile time (switches etc ....) that may not be in my project configuration , explaining the totally different outcomes ???? if yes, please do-tell, so i can fix the ^$%()*&_ other IDE, and submit.

Another funny thing. When i build and run with AppCode, then start Instruments, and attach to the running process : voila ! the leak appears again. It could very well be an Instruments bug (given the shoddy piece of steaming sh... that xCode represent, i have even money on that).

any insights you kind peeps may give me would be appreciated. I loathe the thought of doing my final build/archive with Xcode and have my app bounce on a pseudo-leak.

Context : xCode 5  , AppCode 2.1.2, iPhone 4S test device, game uses cocos2d 2.0

7 comments

Yves,

can't tell anything specific about the problem, but have some details on how AppCode builds apps.
Prior Xcode 5, it overrode build settings to mimic Xcode behaviour, since 'xcodebuild' wasn't able to build a project for an arbitrary destination (apart the one, selected in the Xcode itself and saved as a part of user's workspace). Xcode, on the other hand, didn't override any build setting and built the app as it was. That was the difference.
With Xcode 5 Apple introduces a way to tell xcodebuild the specific destination and, we hope, xcodebuild behaves the wery same way Xcode does.

The difference may also be in a way AppCode and Xcode launch the apps: make sure you have the same debugger selected and that you use 'Debug' in AppCode, instead of 'Run', since Xcode always launches apps in debug (if the debugger is not explicitly disabled in the scheme). To have same LLDB debugger as in Xcode, you'll need the latest AppCode 2.5 EAP.

Hope this help you diagnose the issue.

0

I use the Instruments to launch in both cases. Also, since i'm using the same project space, .xcodeproject ... etc , i had assumed that both IDE's would provide the same outcome. Dont get me wrong : i am trying to fix xCode to mimick what appCode is doing well right now, so that i may have some measure of comfort before submitting.  Will keep looking.  Thanks Anton.

ps. i'm considering reverting to xCode 4.6 and building with SDK 6.1. Probably my next move :(

0

Anton, if i could have your attention again (sorry). After installing EAP latest for the thread on youtrack, i had the inspiration to profile my product with that one too.  Look at the 4 screen shots here.

So now, EAP gives me exactly what xCode did , ie the leak and the 50% oversized app. Could you lead me in the direction of where i could look at the xcodebuild complete and exact command line, so i could try to see what is going on here !!!!  remember, this is straight 'load and start instruments', not changing a single line of code, nor anything else in the project configuration or file structure. I'm stompped.



Attachment(s):
EAPProfileGrowth.png
EAPProfileStart.png
2.1.2ProfileGrowth.png
2.1.2ProfileStart.png
0

You can inkove Build from AppCode 2.5 (running on top of Xcode 5) and check the xcode build command line in Messgaes tool window, Show Build Log button.
After that, launch AppCode 2.1.2 and run build again - you'll see the difference in the command line.

0

tvm Anton. am just focus on the clang for now ... afaik this is the only way to have/not have a behavior like a leak, from build to build without changing anything in the workspace. correct me if you know otherwise please :) ... this is driving me nuts.

0

Try comparing the textual compiler output of AppCode 2.1 and AppCode 2.5 (Messages, Show Build Log) - there may be differences in architectures, of build settings.

0

is this what you meant by compiler output ?

CompileC /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Objects-normal/armv7/SecureGameAssets.o Classes/SecureGameAssets.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/yvesleborg/devel/MaxPowerProject/MaxPower/Adventures
    setenv LANG en_US.US-ASCII
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG -DCOCOS2D_DEBUG=1 -DCD_DEBUG=1 -DMP_DEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -miphoneos-version-min=6.1 -iquote /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Max\ Power\ Adventures-generated-files.hmap -I/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Max\ Power\ Adventures-own-target-headers.hmap -I/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Max\ Power\ Adventures-all-target-headers.hmap -iquote /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Max\ Power\ Adventures-project-headers.hmap -iquotelibs -iquotelibs/cocos2d -iquotelibs/CocosDenshion -iquotelibs/Flurry-iOS-4.2.4 -iquotelibs/kazmath -iquotelibs/UIKeyChainStore -iquotelibs/cocos2d/Platforms -iquotelibs/cocos2d/Support -iquotelibs/Flurry-iOS-4.2.4/Flurry -iquotelibs/Flurry-iOS-4.2.4/FlurryAds -iquotelibs/Flurry-iOS-4.2.4/Licenses -iquotelibs/kazmath/include -iquotelibs/kazmath/src -iquotelibs/cocos2d/Platforms/iOS -iquotelibs/cocos2d/Platforms/Mac -iquotelibs/kazmath/include/kazmath -iquotelibs/kazmath/src/GL -iquotelibs/kazmath/include/kazmath/GL -I/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Products/Debug-iphoneos/include -I/Users/yvesleborg/devel/MaxPowerProject/MaxPower/Adventures/libs/kazmath/include -Ilibs -Ilibs/cocos2d -Ilibs/CocosDenshion -Ilibs/Flurry-iOS-4.2.4 -Ilibs/kazmath -Ilibs/UIKeyChainStore -Ilibs/cocos2d/Platforms -Ilibs/cocos2d/Support -Ilibs/Flurry-iOS-4.2.4/Flurry -Ilibs/Flurry-iOS-4.2.4/FlurryAds -Ilibs/Flurry-iOS-4.2.4/Licenses -Ilibs/kazmath/include -Ilibs/kazmath/src -Ilibs/cocos2d/Platforms/iOS -Ilibs/cocos2d/Platforms/Mac -Ilibs/kazmath/include/kazmath -Ilibs/kazmath/src/GL -Ilibs/kazmath/include/kazmath/GL -I/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/DerivedSources/armv7 -I/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/DerivedSources -Wall -F/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Products/Debug-iphoneos -include /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/PrecompiledHeaders/Max_Power_Prefix-aiuzukksrtuekdawfkjbausxpwft/Max_Power_Prefix.pch -MMD -MT dependencies -MF /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Objects-normal/armv7/SecureGameAssets.d --serialize-diagnostics /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Objects-normal/armv7/SecureGameAssets.dia -c /Users/yvesleborg/devel/MaxPowerProject/MaxPower/Adventures/Classes/SecureGameAssets.m -o /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Objects-normal/armv7/SecureGameAssets.o

Ld /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Products/Debug-iphoneos/Max\ Power\ Adventures.app/Max\ Power\ Adventures normal armv7
    cd /Users/yvesleborg/devel/MaxPowerProject/MaxPower/Adventures
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Products/Debug-iphoneos -Llibs -Llibs/cocos2d -Llibs/CocosDenshion -Llibs/Flurry-iOS-4.2.4 -Llibs/kazmath -Llibs/UIKeyChainStore -Llibs/cocos2d/Platforms -Llibs/cocos2d/Support -Llibs/Flurry-iOS-4.2.4/Flurry -Llibs/Flurry-iOS-4.2.4/FlurryAds -Llibs/Flurry-iOS-4.2.4/Licenses -Llibs/kazmath/include -Llibs/kazmath/src -Llibs/cocos2d/Platforms/iOS -Llibs/cocos2d/Platforms/Mac -Llibs/kazmath/include/kazmath -Llibs/kazmath/src/GL -Llibs/kazmath/include/kazmath/GL -F/Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Products/Debug-iphoneos -filelist /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Objects-normal/armv7/Max\ Power\ Adventures.LinkFileList -all_load -ObjC -fobjc-link-runtime -miphoneos-version-min=6.1 -framework MediaPlayer -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework AudioToolbox -framework OpenAL -lz -framework AVFoundation -framework SystemConfiguration -framework Security -framework iAd -framework AdSupport -lFlurry_4.2.4 -lFlurryAds_4.2.4 -Xlinker -dependency_info -Xlinker /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Intermediates/Max\ Power.build/Debug-iphoneos/Max\ Power\ Adventures.build/Objects-normal/armv7/Max\ Power\ Adventures_dependency_info.dat -o /Users/yvesleborg/Library/Caches/appCode20/DerivedData/Max\ Power-c66c6734/Build/Products/Debug-iphoneos/Max\ Power\ Adventures.app/Max\ Power\ Adventures




i compared the ld and clang lines, they are perfectly identical with both EAP and 2.1.2, yet ... one leaks the other not. I extracted the binary from the app content, they are different (but same size) ... though i used diff to compare them (it does not like binaries, just states 'different'). I dont know what to think. I get the feeling (more and more) that this is an instruments bug. Consider :  If instead of starting with the 'Instruments' button in 2.1.2, I just click the 'Debug' button, the app starts (that is the one that does not leak). Later, if i start instruments by hand, and attach it to the running process, now i get the leak !!!!!

I will do a last ditch test (leak or not). I will prepare an ad-hoc distro (Release,no debug) with 2.1.2 and EAP, and use instruments to monitor processes in the iPhone. See if the process size of the EAP build grows ... at 500K per minute, this should be a short test.
0

Please sign in to leave a comment.