Removing memory leaks in the  App  we develop would be an interesting act .(at least for me). And some times those leaks that have no rationale behind their occurrence can be a nightmare. And I went through this nightmare for over one week. I was gifted by the Instruments tool the following leaks in my app.

  • open_handle_to_dylib_path – Responsible library was CoreGraphics.
  • RegisterEmbeddedAudioCodecs() – AudioToolbox- (This occurred twice.)

For me the Instruments directed me to the line

int retVal = UIApplicationMain(argc, argv, nil, nil);

in the main.m file for first leak. I know there was no rationale behind this problem, but was unsure how I am going to prove it.

And the second problem also was of the same shade pointing me to the line

[audioPlayer play];

in my code.

All these time I was testing my app in iPhone Simulator and I got a way to prove these leaks were untrue.

So I tested my app in the iPhone and got cleared of these leaks. And I was very happy until, I saw another leak from the AudioToolbox library named “CPAThreadStart()”. I am on my way to fix it. But  a thread running in cocos2d gave me little bit of relief  that  the leak is present in AudioToolbox. So hoping that the leak is within AudioToolbox I am closing this post.