Closed Bug 1135278 Opened 11 years ago Closed 10 years ago

shared/js/media/video_player.js leaks memory

Categories

(Firefox OS Graveyard :: Gaia::Video, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: djf, Unassigned)

Details

Attachments

(1 file)

The VideoPlayer class in shared/js/media/video_player.js registers event listeners on the window object for resize and visibilitychanged events and never unregisters them. This means that VideoPlayer objects can never be garbage collected because the window will always have a reference to every one that has been created. Currently, I think that video_player.js is only used by media_frame.js and media_frame.js is only used by Gallery and Camera. And both of those apps only create a fixed number of permanent MediaFrame objects. So this memory leak is not currently affecting anything. Given that we are replacing video_player.js with a web component, I suppose we don't have to fix this. But we should at least update the documentation with a big fat warning about not creating and discarding VideoPlayer objects.
Russ, Would you take this and update the documentation at the top of video_player.js, please? I'm bringing this to your attention so you'll know not to repeat my mistake of adding a resize handler in your web component.
Flags: needinfo?(rnicoletti)
Flags: needinfo?(rnicoletti)
Attachment #8569329 - Flags: review?(dflanagan)
Comment on attachment 8569329 [details] [review] [gaia] russnicoletti:bug-1135278 > mozilla-b2g:master That's a nice, clear comment. Thanks.
Attachment #8569329 - Flags: review?(dflanagan) → review+
Flags: needinfo?(rnicoletti)
OS: Mac OS X → Gonk (Firefox OS)
Priority: -- → P1
Hardware: x86 → ARM
Russ, I saw this was merged to master by Mar 3. Could you help confirm this? and close bug.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(rnicoletti)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: