• 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
Release mode bindings crash and release pools
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Release mode bindings crash and release pools


  • Subject: Release mode bindings crash and release pools
  • From: Jonathan Mitchell <email@hidden>
  • Date: Thu, 15 Jun 2017 12:46:19 +0100

My macOS 10.12 ARC app has a gazillion bindings.

Many are made in the NIBS but a lot are dynamically applied in code.

In release mode I see the odd crash that can be traced back to NSAutoUnbinder
getting dealloc'd in a release pool.
With build optimisations set to 0 there is no issue.
With build optimisations set to s there is an issue (a views window has been
deallocated but the controller dealloc queries the responder chain - which uses
assign semantics - and boom).

The issue occurs when I inadvertently create a binding when my view controller
is about to be torn down.
An NSAutoUnbinder gets created during a bind call and added to the thread
release pool.
The crash occurs when the pool gets drained.

My bindings are such that a dynamic binding can in theory get called when the
view controller is getting torn down so I would like a general solution that
mitigates the possible issue.

Two questions:

1. Does anyone have any insight into why the release pool draining seems to be
an issue in release mode - and I know that trying to second guess the macro
effect of optimisations is pretty thankless. Does the optimisation affect the
ARC calls?

2. Wrapping my -bind: calls in a release pool solves the issue too. I can
easily add a category method that wraps each -bind: call in a release pool. But
what is the over head for this like?

I can of course crank the release optimisation level down to 0 but I have no
guarantee that the issue will still not occur in some situations.

Thanks

J

_______________________________________________

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: Release mode bindings crash and release pools
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: iOS Drag and Drop
  • Next by Date: Re: Release mode bindings crash and release pools
  • Previous by thread: Re: How to validate Core Data attributes ? (example in official doc doesn't work)
  • Next by thread: Re: Release mode bindings crash and release pools
  • Index(es):
    • Date
    • Thread