[RESOLVED] NoScript + Firebug = massive memory leak

Ask for help about NoScript, no registration needed to post
DavidCG
Posts: 14
Joined: Thu Oct 14, 2010 3:44 pm

[RESOLVED] NoScript + Firebug = massive memory leak

Post by DavidCG »

I've been seeing a memory leak for the last couple of weeks - not exactly sure when it started. I've tracked down the cause to being NoScript + Firebug. It happens in daily use but the SunSpider test - http://www.webkit.org/perf/sunspider/sunspider.html - is a good trigger.

Here are results from running SunSpider - 'Private Bytes' as reported by Process Explorer:

1st run = 535,000
2nd run = 800,000
3rd run = 1,016,000
4th run = 1,226,000

With either NoScript or Firebug disabled this does not happen and memory is released and returns to 260,000. In daily use the memory keeps climbing until the browser becomes unresponsive and I need to restart.

Windows 7 + Fx Nightly + NoScript 2.1.1.2rc3 + Firebug 1.8.0b2 (http://getfirebug.com/releases/firebug/1.8/)
Mozilla/5.0 (Windows NT 6.1; rv:7.0a1) Gecko/20110614 Firefox/7.0a1
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: NoScript + Firebug = massive memory leak

Post by Giorgio Maone »

Did you open a bug report in Mozilla's bugtracker?
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
DavidCG
Posts: 14
Joined: Thu Oct 14, 2010 3:44 pm

Re: NoScript + Firebug = massive memory leak

Post by DavidCG »

No. Would they not say it's a problem with NoScript / Firebug?

Also memory use is far higher while the SunSpider test is running when NoScript is installed / enabled.
Mozilla/5.0 (Windows NT 6.1; rv:7.0a1) Gecko/20110614 Firefox/7.0a1
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: NoScript + Firebug = massive memory leak

Post by Giorgio Maone »

DavidCG wrote:No. Would they not say it's a problem with NoScript / Firebug?
Not necessarily.
Both the extensions exercise components of the Gecko platform which are not exercised by the browser itself nor by other popular extensions (NoScript is the main and almost unique client of CAPS, Firebug is the main and almost unique client of the JS debugging API).

Therefore, for instance, an interaction between CAPS and the debugging API which triggers a memory leak would happen only if NoScript and Firebug are both installed, but would be a Firefox bug.
DavidCG wrote: Also memory use is far higher while the SunSpider test is running when NoScript is installed / enabled.
This is not unexpected: benchmarks need to repeat many times in a very short timespan tasks which otherwise would be nearly instantaneous, in order to measure them accurately.
If some of these task requires NoScript to perform a check, and during this check NoScript creates one or two objects, this otherwise modest memory occupation will be multiplied by many times in a timespan too short for the garbage collector to kick in and dispose the already "dead" objects.
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: NoScript + Firebug = massive memory leak

Post by Giorgio Maone »

Side note: for instance, it might be https://bugzilla.mozilla.org/show_bug.cgi?id=646575

Both Firebug and NoScript use Sandboxes (NoScript uses them for surrogates).
Since Firebug, IIRC, creates at least an iframe for each page loaded in the browser, and surrogates are run on each page and subframe, Firebug's presence multiplies the surrogate execution.

If the Sandbox leak is triggered, this could create your problem.

Does disabling surrogates (noscript.surrogate.enabled -> false in about:config) help?
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
dhouwn
Bug Buster
Posts: 968
Joined: Thu Mar 19, 2009 12:51 pm

Re: NoScript + Firebug = massive memory leak

Post by dhouwn »

Here some helpful meta-bugreports (bugreports pointing to bug-reports with something in common), maybe the issue already reported there: The Mozilla devs will probably want from you create a simple test case which in this case would be a simple what-to-do list on when starting from an empty profile and a description on which versions it happens, then they will probably want from you that you post the contents of the improved about:memory interface from Firefox 6+.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
DavidCG
Posts: 14
Joined: Thu Oct 14, 2010 3:44 pm

Re: NoScript + Firebug = massive memory leak

Post by DavidCG »

Giorgio Maone wrote: Does disabling surrogates (noscript.surrogate.enabled -> false in about:config) help?
It helps - but does not fix the problem.

Here are memory readings (in 1000 kbs) after each SunSpider run: 380, 420, 456, 473, 496

Thanks for the explanation and bug report. I'll take a look tomorrow and raise a new bug or add details to an existing one.

dhouwn, thanks for those bug reports. I'll take a look at those as well.
Mozilla/5.0 (Windows NT 6.1; rv:7.0a1) Gecko/20110614 Firefox/7.0a1
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: NoScript + Firebug = massive memory leak

Post by Giorgio Maone »

DavidCG wrote:
Giorgio Maone wrote: Does disabling surrogates (noscript.surrogate.enabled -> false in about:config) help?
It helps - but does not fix the problem.
Please set the noscript.toStaticHTML about:config preference to false as well.
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
DavidCG
Posts: 14
Joined: Thu Oct 14, 2010 3:44 pm

Re: NoScript + Firebug = massive memory leak

Post by DavidCG »

Giorgio Maone wrote: Please set the noscript.toStaticHTML about:config preference to false as well.
That helped by significantly reducing memory usage while running the test - but memory still crept up: 338, 385, 429, 470
Mozilla/5.0 (Windows NT 6.1; rv:7.0a1) Gecko/20110614 Firefox/7.0a1
User avatar
GµårÐïåñ
Lieutenant Colonel
Posts: 3369
Joined: Fri Mar 20, 2009 5:19 am
Location: PST - USA
Contact:

Re: NoScript + Firebug = massive memory leak

Post by GµårÐïåñ »

A similar claim was made BUG 639186 and there was some discussion that might help, not sure if they are deeply connected issues but it might shed some light.
~.:[ Lï£ê ï§ å Lêmðñ åñÐ Ì Wåñ† M¥ Mðñê¥ ßå¢k ]:.~
________________ .: [ Major Mike's ] :. ________________
Mozilla/6.9 (en-US; rv:6.9.6.9) Gecko/66666666 Firefox/6.6.6
DavidCG
Posts: 14
Joined: Thu Oct 14, 2010 3:44 pm

Re: NoScript + Firebug = massive memory leak

Post by DavidCG »

Apologies for vanishing. Real Life got in the way.

I've just retested with latest nightly and I'm no longer seeing the problem. I'll run with Firebug + NoScript enabled and see if the leak happens with daily browsing. I'll report back and open a ticket if it does.
Mozilla/5.0 (Windows NT 6.1; rv:8.0a1) Gecko/20110714 Firefox/8.0a1
User avatar
GµårÐïåñ
Lieutenant Colonel
Posts: 3369
Joined: Fri Mar 20, 2009 5:19 am
Location: PST - USA
Contact:

Re: NoScript + Firebug = massive memory leak

Post by GµårÐïåñ »

DavidCG wrote:Apologies for vanishing. Real Life got in the way.
That's ok, its understandable.
DavidCG wrote:I've just retested with latest nightly and I'm no longer seeing the problem. I'll run with Firebug + NoScript enabled and see if the leak happens with daily browsing. I'll report back and open a ticket if it does.
Glad the problem is resolved, keep us posted if you find anything new.
~.:[ Lï£ê ï§ å Lêmðñ åñÐ Ì Wåñ† M¥ Mðñê¥ ßå¢k ]:.~
________________ .: [ Major Mike's ] :. ________________
Mozilla/6.9 (en-US; rv:6.9.6.9) Gecko/66666666 Firefox/6.6.6
Post Reply