Today I want to announce a new extension for Firefox. It’s been developed by the Mozilla QA Automation Services team, which exists to support the Mozilla QA community by developing tools and frameworks for ease of testing. And this time, in case of the extension, we even target (web) developers, and our huge Firefox user base. So what is it about?
Mid of December 2011 bug 711900 has been filed. It complained about an increased garbage and cycle collector activity in Firefox 10, which was not existent in Firefox 9. So Mozilla QA has been asked to analyze that behavior and find possible use cases for reproduction. While working on it, we noticed that observing the related information about memory usage and garbage/cycle collector activity wasn’t that comfortable. For the memory you have had to constantly watch and refresh ‘about:memory‘ in a separate tab, and the latter even forced us to always have the Error Console open and a specific hidden preference set.
To make it easier for us I had the idea of creating an extension, which would be able to present all the necessary information at a prominent place and would be visible all the time. There should be no need of switching tabs or scraping the Error Console for output. Scraping was even hard because all entries constantly get wiped out when a maximum threshold of messages has been reached. Further copying out this data is a hassle. So lets create an extension with logging capabilities…
Some days later after an internal discussion across teams we started the development and called it the MemChaser project. Based on the fantastic help from members of the SpiderMonkey team – lets name Nicholas Nethercote and Andrew McCreight – we got a very early prototype setup kinda quickly. But as is turned out having an extension, which needs a restart to get installed, is pretty useless if the user is already facing a strange memory related issue. So one of the bigger tasks was to get familiar with the Add-on SDK project aka Jetpack and to transform the extension into a restartless one. As it turned out the work wasn’t that hard but gave us well better structured code and a nice toolchain to test and build the extension. And finally with all the features implemented we were able to release the MemChaser extension on addons.mozilla.org.
The current set of features is not that big but covers all the requirements we got from the QA team. We will make sure to enhance the extension drastically in the next couple of months so that it doesn’t only display current values in the Add-on bar. But what is it doing right now?
As you can see in the image a couple of values are displayed. But what do those stand for? Here the answer:
- Resident: Memory mapped by the process that is present in physical memory. It’s normally the memory usage you will see in the systems process manager.
- GC: Duration of the last Garbage Collector activity and in brackets the time when the second last activity happened.
- CC: Duration of the last Cycle Collector activity and in brackets the time when the second last activity happened.
- Logging: Starts and stops the internal logger, which writes out the current memory usage and GC/CC activities to a log file, which can be found in the memchaser sub directory of your Firefox profile.
All those information already helps a lot to keep track of memory related activities and enables someone to see if Firefox is using too much memory at all or is having long GC/CC cycles which could freeze the UI of Firefox for short moments.
As I have mentioned above we will continuously enhance the features of the extension. We already have some great ideas and I will certainly blog about those more in the next couple of days, once we have updated our documentation and set milestones for the next releases.
For now please install the extension in your daily profile and watch the memory activities. If you recognize strange behavior turn on logging and let us know by contacting us directly.
Does the addon’s functions affect general performance in any meaningful way? Does having logging constantly enabled do (I can always set up a scheduled/cron job to delete old logs)?
Given that all installers of this extension may not read this blog entry (or even if they do may not remember it all) why don’t you put the descriptions you just gave into tooltips that appear on hover?
You can even include the log file location bit under the current logging button text.
It may be a bit verbose, but I think the current audience of this addon will be more helped than not.
Also, I use a dark (mostly black background) Persona and the black text completely disappears on it. Only the red text & colored button gives evidence of the addon’s presence.
@Ferongr – No, from what I gather, its affect on performance is next to nil.
+1 to Caspy’s tooltip suggestion.
In addition, it would be worth putting a link to this post in the Addon’s description. It has plenty of useful information which people who go AMO might otherwise miss.
@ferongr: No, as for now there is nothing which would affect the performance. We will make it our priority to keep it that way. Regarding your logging question: you will have to enable logging manually after you have started Firefox. We do not enable it automatically for now. But it’s nice idea. I have created https://github.com/whimboo/memchaser/issues/59
@Caspy7: We are a bit limited by the Add-on SDK for the time being. There are some features we can’t actually use because they are broken. The color of the text is one example. I have made it that way that at least most of our users will be able to read the text. I will see what I can do for https://bugzilla.mozilla.org/show_bug.cgi?id=718015. The tooltip is also not that easy to do for each single element because all the text you see is embedded inside an HTML frame. I will check what’s possible and have created an issue: https://github.com/whimboo/memchaser/issues/60
@Lozzy: Good idea! I will make sure to add all the information to the description box of the add-on on AMO.
I at that issue for the tooltip.
It would be a very ugly thing to do, but, if it’s possible, perhaps copying and pasting the full list of helpful text into the widget tooltip would still make the addon overall more usable.
Just an interim, workaround thought.
Doesn’t appear to be displaying anything in the latest nightly build of Firefox 13a1. 🙁
I take that back, if I movie it out of the addon bar and move it to the navigation toolbar, it starts displaying data. =)
Well, this explains why my Firefox is so stuttery. It starts around 250ms for the GC and 570ms for the CC and doesn’t take long under normal use to climb to roughly 570ms for the GC and 1700ms for the CC.
The problem is, I’m fairly certain one or more of the extensions I consider indispensable is to blame. (Given that the RSS climbs to over a gigabyte and I’m getting zombie compartments)
Any idea when tools suitable for mildly skilled end users (I’m a Python/PHP/JS programmer and I run Linux exclusively) might be available to help track down this kind of problem?
@Stephan: Which version of Firefox are you using? Is it an Aurora or even Nightly build? If yes you should probably comment on . Sounds like you are also affected by this bug. Doing a log with MemChaser for about 1h and attaching it beside the comment would also be helpful.
There are some tools available and with the MemChaser project we want to make those more easily accessible. In general it really depends on what you are looking for and is probably worth another blog post (from the JS devs).
I would say lets start with your issue from top and find out more in incremental steps. So please check out the bug I have mentioned. Thanks for your feedback!
I used to run Chrome on the beta channel but, for Firefox, I don’t trust upgrading and downgrading to leave my profile in a usable state so I stay on the release channel.
My main concern is that, since this takes some time to build up, if I make a copy of my profile to test on Aurora or Nightly, I might accumulate state that could take a while to track down and copy back into my stable profile. (eg. bookmarks injected by StumbleUpon, etc.)
Since I’m already a bit behind in my French course, I’m not sure when I’ll have time to take that risk.
I am definitely looking forward to when release catches up with the minimum requirements of some of the performance-analysis extensions for Aurora and Nightly though.
Hah. That nailed my problem…thanks guys. Great tool.
I’m getting gc:~600ms / cc:~1700ms times… till now I couldn’t determine the cause of the UI hangs – now I can.
Cheers
Ben, good to hear. When you say that you are able to determine the reason for ui hangs, what are those in specific? Has there been filed a bug on Bugzilla for it already?
how to analyse the memchaser logs? got a few logs but not knowing how to identify a leak and fix the same in MY APPLICATION – which is a js component
Varadarajan, I would suggest that you get in contact with some developers. So joining #developers on irc.mozilla.org might be helpful. There you should look out for ´smaug´ . He is most likely the best person to help you. If you need help let me know!