[Greasemonkey] Possible source of memory leaks

Jeremy Dunck jdunck at gmail.com
Sat Jul 9 10:35:19 EDT 2005

On 7/9/05, Aaron Boodman <zboogs at gmail.com> wrote:
> > Yes, it's pertinent now.  Because of the bug where removed elements
> > lose their listeners, command callbacks are called with expando props.
> Have you tested whether this actually occurs in 0.4? My extremely
> scientific test of opening and closing lots of tabs which used
> GM_registerMenuCommand showed no significant lossage in 0.4. Maybe it
> was a bad test. Let me know if you see leakage because...

I have not done any significant testing with 0.4.  So you're right, I
shouldn't be chicken-littling.

> > I also just happened on this bug, which nails us again:
> > "calling addEventListener with a closure holding a content node leaks
> > the document"
> > https://bugzilla.mozilla.org/show_bug.cgi?id=241518
> Again, do you have evidence of this? It's a pretty obvious pattern to
> create a closure which holds a DOM node other than document, and I
> usually avoid it like the plague.

Sorry, I should have been clearer.  What I meant was, the closure in
the callback handed to us by content might have DOM nodes.  We can't
know we're not hanging on to stuff.

> > These are meaty Moz bugs, and it's starting to hurt.
> > I just had to admit to a coworker that his FF ate 200MB cuz of us.   I
> > imagine there are many more similarly annoyed.
> I think maybe this embarassing situation with your coworker has
> convinced you that there is some ongoing unwinnable battle with memory
> leakage. 

Again, sorry for not being clear.  I meant mixing content w/ XUL seems
to have been a bad idea, and we're bumping heads on XUL bugs pretty
often.  I'd rather not expose APIs that are subject to breakage due to
bugs not under our control.

> I'd rather have some testing of the current rewrite before throwing it
> away! I don't really think there is a magic bullet here. Yes, the
> current version on the website leaks. We are all painfully aware of
> that. But isn't the question that matters whether the current version
> in CVS leaks? If so, let's fix it. I'm not convinced it will be that
> hard.

I'll do some testing on it.  I'm sure what you've already done is good
stuff.  Sorry for overreacting.

More information about the Greasemonkey mailing list