Re: Removing Observers eats up memory
Re: Removing Observers eats up memory
- Subject: Re: Removing Observers eats up memory
- From: Markus Spoettl <email@hidden>
- Date: Mon, 25 Jan 2016 22:24:29 +0100
On 25/01/16 18:34, Quincey Morris wrote:
On Jan 25, 2016, at 01:10 , Markus Spoettl <email@hidden
<mailto: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.
Yes, true, worth a shot. Unfortunately not the problem, it all happens on the
main thread. The code also doesn't use ARC (though the standard libs might, I
don't know).
Ken's suggestion implementing observationInfo solves this issue for me.
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