• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Swift 3 - Notification leaks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Swift 3 - Notification leaks


  • Subject: Swift 3 - Notification leaks
  • From: Andreas Mayer <email@hidden>
  • Date: Sat, 18 Jun 2016 13:21:43 +0200

I have just migrated a project to Swift 3 which worked surprisingly well for the number of changes necessary.

After checking out the new memory graph (cool!) I noticed that I am leaking notifications. Example:

	NSConcreteNotification 0x102c28600 {name = NSApplicationDidBecomeActiveNotification; object = <NSApplication: 0x100e15080>}

The really bad thing is, some were keeping old windows in memory!


After changing back to NSNotification where possible, all is well again.

Leaking:

	func windowDidBecomeKey(_ notification: Notification) {

Working:

	func windowDidBecomeKey(_ notification: NSNotification) {


Block based observers do still leak though.


This is what it looks like:

http://www.harmless.de/images/other/Notification-Leak.png

(Is there a way to get a textual representation of that graph?)

And here the backtrace:

http://www.harmless.de/images/other/Notification-Leak-Backtrace.png

Just below that is my window's init call.

(I couldn't figure out how to copy the backtrace either.)


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Swift 3 - Notification leaks
      • From: "Gary L. Wade" <email@hidden>
    • Re: Swift 3 - Notification leaks
      • From: Roland King <email@hidden>
  • Prev by Date: Security with Streams
  • Next by Date: Re: Swift 3 - Notification leaks
  • Previous by thread: Re: Security with Streams
  • Next by thread: Re: Swift 3 - Notification leaks
  • Index(es):
    • Date
    • Thread