Closed Bug 652530 Opened 13 years ago Closed 13 years ago

Memory leak when updating widget's content

Categories

(Add-on SDK Graveyard :: General, defect, P1)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: peregrino, Assigned: ochameau)

Details

Attachments

(3 files)

Attached file testcase
When trying to update the content of an already existent widget, it seems that the previous content is leaked. 

I attach a testcase that creates a widget and updates its content 1000 times, and the leak can be appreciated. With another testcase I could get Firefox to 1Gb RAM by updating a widget about 4000 times.

The workaround I found is to update the content by passing a message to the widget and listening to it on the contentScript.
Priority: -- → P1
Target Milestone: --- → 1.0
Alex: can you take a look at this?
Nice catch Hernán!
Here is this leak in details using this unit test:
With 200 instances
 before: 45231876
 after : 49095036
Assignee: nobody → poirot.alex
Attached patch Fix this leak.Splinter Review
And now, with this patch, we have:
 before: 45426972
 after : 44792644
(memory used before and after changing 200 times widget.content attribute)

This leak was due to document-element-inserted/DOMContentLoaded/load listeners not unregistered when you change Symbiont contentURL *and* because we do not destroy the Symbiont before creating a new one in Widget.setContent.
Attachment #531726 - Flags: review?(rFobic)
Comment on attachment 531726 [details] [diff] [review]
Fix this leak.

Review of attachment 531726 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks Alex.
Attachment #531726 - Flags: review?(rFobic) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: