• 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
Removing Observers eats up memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Removing Observers eats up memory


  • Subject: Removing Observers eats up memory
  • From: Markus Spoettl <email@hidden>
  • Date: Mon, 25 Jan 2016 10:10:38 +0100

Hi,

I have a view controller with a table view that is bound to an array containing around 1000-10000 model objects. The same view controller registers itself as observer of all the objects' properties. These objects are actually proxies for other model objects and are created by my view controller (there is no outside reference to these objects).

When the array changes, I remove all observers from these objects before re-observing the new objects.

Sometimes (on El Capitan) this removing of observers causes my app to freeze and eat memory at an alarming rate. Sometimes this spirals completely out of control until all memory is exhausted, sometimes it stops after a few gigabytes of mystery allocations and my app continues.

The bug doesn't surface all the time, only 30-50% of all tries.

I have tried to wrap the observer removing code within an @autorelease {} block, which helps a little. The problem is now harder to recreate, but it is still there.

This is on El Capitan using Xcode 6.4 built against the 10.10 SDK.

Has anyone any idea how the removing of observers can cause this kind of death spiral?

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

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: Removing Observers eats up memory
      • From: Ken Thomases <email@hidden>
    • Re: Removing Observers eats up memory
      • From: Quincey Morris <email@hidden>
    • Re: Removing Observers eats up memory
      • From: Richard Charles <email@hidden>
    • Re: Removing Observers eats up memory
      • From: "Gary L. Wade" <email@hidden>
  • Prev by Date: Diff view framework?
  • Next by Date: Re: Diff view framework?
  • Previous by thread: Re: Diff view framework?
  • Next by thread: Re: Removing Observers eats up memory
  • Index(es):
    • Date
    • Thread