tags:

views:

550

answers:

4

I have a leak in my app I really can't make sense of, can anyone help me with it?

Instruments Stacktrace:

       0 libSystem.B.dylib calloc
       1 WebCore CurrentThreadContext()
       2 WebCore WKSetCurrentGraphicsContext
       3 UIKit -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:includeEmoji:]
       4 UIKit -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:]
       5 UIKit -[UILabel _drawTextInRect:baselineCalculationOnly:]
       6 UIKit -[UILabel drawTextInRect:]
       7 UIKit -[UILabel drawRect:]
       8 UIKit -[UIView(CALayerDelegate) drawLayer:inContext:]
       9 QuartzCore -[CALayer drawInContext:]
      10 QuartzCore -[CALayer _display]
      11 QuartzCore -[CALayer display]
      12 QuartzCore CALayerDisplayIfNeeded
      13 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
      14 QuartzCore CA::Transaction::commit()
      15 QuartzCore CA::Transaction::release_thread(void*)
      16 libSystem.B.dylib _pthread_tsd_cleanup
      17 libSystem.B.dylib _pthread_exit
      18 Foundation +[NSThread exit]
      19 Foundation __NSThread__main__
      20 libSystem.B.dylib _pthread_body
      21 TestApp 0x0
+2  A: 

Is this on the simulator or a physical device?

If it's on the simulator, please test against a physical device for leaks. The simulator is known to have weird leaks that devices don't have.

If this is on a physical device, I'm also at a loss to explain it :\

Ben S
It is a physical Device -.-
MrThys
Have you looked to see if there's a bug report for something similar? If not I would report it. This doesn't look like something caused by your application.
Ben S
+1  A: 

what are you doing before leak appeared? some things may cause leaks, for example, trying to make UI changes not from the main thread.

Morion
How do you mean not from the main thread? Most of my drawing is done from the View(Will/Did)Appear methods. Or a UITableViewController which is filled from a thread.
MrThys
for example, if you use NSOperationQueue. all operations are in the parralel threads. I had a memory leak when tried to show alert in my operation.
Morion
A: 

Looks to me like a leak inside webkit... probably not much you can do about it other than file a report with Apple.

Jasarien
A: 

I think Morion is right. Never ever do something with the UI from another thread than the main thread. I had the funniest things happening when doing this by accident.

You said:

Most of my drawing is done from the View(Will/Did)Appear methods. Or a UITableViewController which is filled from a thread.

So, the controller gets filled by another thread, which means this drawing is also executed in this "other" thread. Try to use performSelectorOnMainThread:withObject:waitUntilDone:

Take a look here: Reference Documentation

Hutaffe