When i draw a PDF i saw from instruments that if the CGContextDrawPDFPage method is not called from main thread, creates a leak in memory.
Someone has encountered the same problem?
Any help is appreciated.
It’s been a while, but I recall that the PDF functions involved a fair amount of lazy instantiation or caching. Is Instruments showing a true leak, or just allocations that don’t go away?
I remember getting concerned about memory bloat, until I realized it went away when I released the higher-level objects (CGPDFDocumentRef, I think).
Related
I have an IOS app that displays images and text in a UITableView. When I scroll up and down I get this unbounded memory growth. I have used Allocations to attempt to find out where this memory growth comes from. Please see below. From what I can see, CFString takes up a huge amount of memory. It doesn't appear to be from my code(based on StackTrace of CFString) as seen in Figure 2.
Please can someone advise? I'm really stuck. My app is crashing after a few minutes of scrolling after exceeding around 2GB of memory. I would appreciate any general pointers on how to debug the origins of the memory issue. The CFString stack trace appears all grayed out and I'm not sure how to proceed to diagnose the issue.
Figure 1
I am looking at CFString and the persistent memory is huge.
Figure 2
Clicking on CFString:
Try using the Instruments app, in the Xcode utilities folder. Specifically you want the Leaks instrument. It will find leaked memory, and then help you figure out where that memory gets allocated.
Run your app for a while, then break it and examine your heap.
(It's rather complex and tricky to use. Much more than I can explain in an SO answer. I suggest digging up a WWDC video or other tutorial on using it.)
There is also a simple memory graph tool in Xcode that flags leaked blocks, but it doesn't give you as much information. (It's one of the little icons in the debug bar above the debug console. The icon is 3 little circles with lines between them.)
I'm developing Keyboard Extension on iOS 8.3
While developing there is a memory leak somewhere after calling advanceToNextInputMode.
And the Responsible Frame and leaked Object are looks like totally out of my control.
Can anybody meet anything similar problem?
I have this exact problem. It is Apple's fault. The total amount of memory leaked is pretty tiny though. File a bug report so they'll take it more seriously (I've already filed, but more always help).
I have two controllers and first controller pushes the second one.
I was using the allocation of the instrument to check memory allocations and I found sometimes a peak occurs in the allocation graph. Following is the screenshot.
What is the reason of this? is this normal or this is kind of problem, may be leak? I use arc by the way.
I also used leaks to find any memory leaks but it didnot show any.
I'm doing a screenshot of the allocations in my project. I've simulated a memory warning at 50 seconds, but the allocations never go back down. Maybe I don't understand this one correctly?
I think the graph is displaying the overall bytes, ie all the memory consumed by the application during her running time
It turns out that NONE of my big objects (UIViews / Controllers) were ever being released. After diving in I'm seeing some up and down like I should be.
I'm attempting to use the Memory Leak instrument in Xcode 4 with iOS 5.1 (ARC enabled) and I am spotting memory leaks, but how the hell do I get to the line of code causing the leak? I've read a few tutorials on this but it seems to be an older version of the instrumentation tool because when I click on the extended detail tab and double click on items in the backtrace I'm presented only with useless assembly code. Also none of the items on the stacktrace are any of the classes that I've written. Am I missing something?
If your code leaks memory, you will see your relevant methods in the details tab, right where you are looking. They are displayed in black as opposed to methods in the APIs which are gray. You can't look into API Methods of course, hence the assembly code. If there is really something wrong in your code, set the slider on the bottom of the tab on the rightmost position and you should see the concerned methods.
If still none of them are in your code, you probably just don't leak anything. (There are actually not many scenarios in which ARC-Code can leak memory. Retain cycles are probably the most common one) I stumbles over one or two cases in which an API was 'leaking' memory. There is really nothing you can do about it and most likely, it's just a false positive anyway rather than a real leak. If you are only 'leaking' a few bytes, I wouldn't worry about it.