Garbage Collection improvements in Firefox improve memory usage

download mod apk

Mozilla introduced Garbage Collection in Firefox 38 that improves memory management of the web browser as part of the organization’s ongoing effort to bring memory usage of the browser down and optimize it as best as possible for all use cases.

Compacting is one feature of the garbage collector that is currently only supporting JavaScript objects. It dropped memory usage on a test system — the lead developers own – with 50 tabs open by about 2%. While that may not look like much, as it dropped usage on the system by about 30 Megabyte only to 1300 Megabyte total, it is just the first step with others to follow which will bring down memory usage further.

So how does compacting work in Firefox?

The JavaScript Heap uses arenas, 4K blocks of memory which are made up of cells that have fixed sizes. Each arena contains cells of the same kind and size only, and can only be freed if there are not any live cells in it anymore.

mod apk

Memory problems arise when many arenas with few live cells each exist as the space cannot be released to memory in this case, While “dead” cell space can be used by the same kind, they cannot be used by different kinds.

Mozilla’s algorithm works by moving live cells between arenas to reduce the number of arenas used by the Heap. It works by selecting appropriate cells, moving them and updating all pointers to make sure no objects or data is lost in the process.

The selection process lists all arenas with live cells in decreasing order and splits it in half to move cells out of arenas with few cells to release them to memory afterwards.

It is interesting to note that compacting triggers only on three specific events currently:

  1. When Firefox is running out of memory.
  2. When the operating system sends a “memory pressure” event.
  3. When the user has been inactive for a certain period of time (currently about 20 seconds)

Check how much memory free cells use

firefox heap

You can check how much memory cells use in Firefox.

  1. Type about:memory in the browser’s address bar and hit enter.
  2. Search for js-main-runtime-gc-heap-committed
  3. Locate gc-things in its tree.

Additional information about the process are available on Mozilla Hacks.

Closing Words

There is a imbalance currently in the reporting that covers Firefox and Mozilla. Feature removals and additions get lots of publicity, usually by Firefox users opposing the change, whereas core improvements like these, that are mostly under the hood, get little to no publicity at all.

Mozilla could do a better job at promoting those under the hood improvements as those are features that are — usually – welcome by all users of the browser.

Now read: Which Firefox features would you like to see removed, and which polished?


Article Name

Garbage Collection improvements in Firefox improve memory usage


Martin Brinkmann


Mozilla introduced Garbage Collection in Firefox 38, and one of the features allows for the compacting of data to save memory.

About Martin Brinkmann

Martin Brinkmann is a journalist from Germany who founded Ghacks Technology News Back in 2005. He is passionate about all things tech and knows the Internet and computers like the back of his hand. You can follow Martin on Facebook, Twitter or Google+

You are here: Home > Firefox > Garbage Collection improvements in Firefox improve memory usage

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at