开发者

Tracing memory leak

There is a memory leak in my cocoa application and I have done everything possible to find its owner but have been unable to. The leak began a couple days ago when I implemented the GCD version of the AsyncSocket framework. I do not know if it is my own code making the leak appear or if it is the library itself. Instruments does not provide a good back trace. Only thing vague one:

   0 libSystem.B.dylib calloc
   1 CoreFoundation __addHandler2
   2 Foundation +[__NSObserver isAnObserver:]
   3 Foundation -[NSNotificationCenter removeObserver:name:object:]
   4 Foundation -[NSNotificationCenter removeObserver:]
   5 Foundation -[NSRunLoop(NSRunLoop) dealloc]
   6 CoreFoundation CFRelease
   7 CoreFoundation __CFFinalizeRunLoop
   8 libSystem.B.dylib _pthread_tsd_cleanup开发者_C百科
   9 libSystem.B.dylib _pthread_exit
  10 libSystem.B.dylib start_wqthread

Can someone please point me in the direction needed to do more advanced tracing or reverse engineering, etc.?


Did you try doing build and analyze on your app? That helps in finding alloc-release based memory leaks which could be overlooked sometimes. You can also use the library with the source files imported into your project and then do build and analyze to run analysis on the library.


If some of your objects add themselves as observers to NSNotificationCenter, make sure you do removeObserver: before these objects are deallocated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜