Hello,

Replying to myself on this thread to give some news on this side.

Le 30/07/2015 12:41, Alexandre Lissy a écrit :

[...]

> 
> There's another big issue: the |observe()| method does a
> |mozSettings.addObserver()| each times it is called.
> 
> Code using this should be aware of this. We landed "unobserve" method to
> make it more obvious that this needs to be taken care of.
> 
> Now, one issue that is specific to System app mostly is the case where
> code path that does |SettingsListener.observe()| are called in a
> recurrent manner. This is leaking observers on the API.
> 
> As much as I debugged last time on the API side, it was quite tricky to
> detect those bad cases. We do cleanup observers reference when
> windows/apps are being killed but System app is not always in this case.
> 
> One nasty consequence of those leaks is that your device will slowly
> become slower over time.
> 

That is not something purely theoretical, we have a history of having
some of those:
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1089619
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1105639
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1189078
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1189758
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1193051

To help avoid letting those happen, we landed a change to the
mozSettings API: https://bugzilla.mozilla.org/show_bug.cgi?id=1193469

Basically, we are:
 - lowering the threshold for number of observers that a SettingsManager
instance can have on the same key from 20 to 10
 - if we reach this threshold we will dump warning in the console
 - on debug builds this will throw

We hope this will help people be able to more easily detect when there
is such kind of leak happening.
_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to