Closed Bug 1298161 Opened 8 years ago Closed 8 years ago

android.os.StrictMode$InstanceCountViolation: class org.mozilla.gecko.BrowserApp

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox51 fixed)

RESOLVED FIXED
Firefox 51
Tracking Status
firefox51 --- fixed

People

(Reporter: jchen, Assigned: jchen)

Details

Attachments

(4 files)

When we recreate BrowserApp instances, previous instances are leaked as shown by InstanceCountViolation in the logcat, e.g.,

> android.os.StrictMode$InstanceCountViolation: class org.mozilla.gecko.BrowserApp; instances=nnn; limit=1

I looked through a memory profile and there were several sources of leaks.
Move registration of AccessibilityManager listeners to GeckoApplication,
and change all Context references to the application context, so that
GeckoAccessibility doesn't leak old BrowserApp instances as new
BrowserApp instances are created.
Attachment #8785366 - Flags: review?(s.kaspari)
Unregister certain events in BrowserApp and GeckoApp to prevent
BrowserApp from leaking. Also, properly unregister event listeners in
PageActionLayout to prevent BrowserApp leaks, because
PageActionLayout.onDestroy never got called before.
Attachment #8785367 - Flags: review?(s.kaspari)
Properly remove pref handler on destroy to prevent leaking BrowserApp.
Attachment #8785369 - Flags: review?(rbarker)
Use application context for delayed callbacks to prevent leaking the
BrowserApp instance. Also, use application context for accessing
Distribution, to prevent leaking old BrowserApp instances, and to avoid
using a destroyed Context. Finally, attach AudioFocusAgent to the
application context instead of the BrowserApp context to avoid leaking
BrowserApp.
Attachment #8785370 - Flags: review?(s.kaspari)
Attachment #8785369 - Flags: review?(rbarker) → review+
Attachment #8785366 - Flags: review?(s.kaspari) → review+
Attachment #8785367 - Flags: review?(s.kaspari) → review+
Attachment #8785370 - Flags: review?(s.kaspari) → review+
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/fx-team/rev/18a92c5e14e6
a. Fix BrowserApp leak in GeckoAccessibility; r=sebastian
https://hg.mozilla.org/integration/fx-team/rev/2c6691bd8a71
b. Fix BrowserApp leaks in event registration; r=sebastian
https://hg.mozilla.org/integration/fx-team/rev/322bce6bc1d6
c. Properly remove pref handler in NativePanZoomController; r=rbarker
https://hg.mozilla.org/integration/fx-team/rev/803dba6b6691
d. Use application context to prevent BrowserApp leaks; r=sebastian
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: