Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone/Objective-C - Memory leaks in QuartzCore library

I am running the Instruments Tool (Leaks) and am receiving memory leaks in the QuartzCore library and don't know exactly where in my code this is occurring. Usually I'm able to pin point the line where the leak is occurring, however the instrument tool isn't giving me anywhere to view this type of information.

What would be some other things I could look at in terms of diagnosing such a leak?

enter image description here

enter image description here

like image 654
fulvio Avatar asked May 05 '11 04:05

fulvio


2 Answers

First, try running this on the device. Sometimes the simulator will report leaks that do not exist on the device.

Secondly, open up the stack trace (right sidebar) and see what code of yours might be involved higher up in triggering this call, then you can think from there why that code might be leaking.

One additional bit of advice. Instead of playing with leaks there, switch over to ObjectAlloc and use the Heapshot feature - if you know about where the leak is, use the heapshot to set a base memory measurement and every time you hit the "heapshot" button after that you'll see a kind of memory "diff" against that baseline you set. Solving any over-retained problems might also fix your leak.

like image 59
Kendall Helmstetter Gelner Avatar answered Nov 16 '22 04:11

Kendall Helmstetter Gelner


If you’re only leaking 16 bytes at a time, it’s really not likely to become an issue in your app. And if the leak is occurring in a system framework, it probably isn’t your fault.

like image 30
Noah Witherspoon Avatar answered Nov 16 '22 03:11

Noah Witherspoon