开发者

Tracing memory leaks

My favorite candidate again. I am in the process of identifying memory leaks in my app (a puzzling challenge for a newbe like me).

I am using the xCode leak analyzer, but what puzzles me i开发者_高级运维s how to trace back a memory leak to its variable or value. Is there a pointer to the instances that have reserved a memory address where a leak is identifyed?

How do I best go about it?


Are you aware of the Clang analyzer? Hit Cmd-Shift-A in Xcode and prepare to be pleasantly surprised. (This should run the Build → Build and Analyze command. It’s something like building the sources, but you get an analyzer log instead of the binary. Hopefully the analyzer will detect at least some of your leaks.)


The XCode leak analyzer tells you where the objects that were leaked were created, if you click the 'extended detail' tab on the right side of the toolbar at the bottom of the window. A call stack showing you which function created the object is shown on the right.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜