Re: Removing Observers eats up memory
Re: Removing Observers eats up memory
- Subject: Re: Removing Observers eats up memory
- From: Quincey Morris <email@hidden>
- Date: Mon, 25 Jan 2016 09:34:33 -0800
- Feedback-id: 167118m:167118agrif8a:167118suYJcD4DRz:SMTPCORP
On Jan 25, 2016, at 01:10 , Markus Spoettl <email@hidden> wrote:
>
> Has anyone any idea how the removing of observers can cause this kind of death spiral?
Genocidal refreshes aside, are you absolutely sure that you’re always removing/adding observers on an appropriate thread? There are two dangers here:
1. You may be doing things on a background thread that are supposed to be done on the main thread.
2. You may be doing things on multiple threads. In particular, doing massive quantities of retains and releases (via ARC) on multiple threads simultaneously has terrible performance characteristics, because (I think) there’s a lock involved. I would also assume that massive quantities of multi-threaded allocs and frees would be bad, because there has to be some kind of lock there too.
Without contention, these locks are likely zero-cost (more or less). With parallelism, the results can be bad.
There’s no particular reason to think that any of these things are happening in your scenario, but they might be worth looking into.
_______________________________________________
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