Thizzer
Thizzer

Reputation: 16653

0x0 memory leak [iphone]

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

Upvotes: 3

Views: 1363

Answers (4)

user234490
user234490

Reputation:

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

Upvotes: 0

Jasarien
Jasarien

Reputation: 58448

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

Upvotes: 0

Morion
Morion

Reputation: 10860

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

Upvotes: 2

Ben S
Ben S

Reputation: 69342

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 :\

Upvotes: 2

Related Questions