The cause? GNOME forgetting to take out the garbage…

Some good news: the (rather large) GNOME Shell memory leak we spotlighted last week is in the process of being fixed.

GNOME developers have spent the past week or so trying to identify the root of the issue, which causes system memory usage to increase each minute GNOME Shell is used.

Following our report hundreds of GNOME Shell users across various Linux distros took to internet forums and social media to confirm the memory creep issue exists on their systems.

And with system slow downs and graphics performance issues among the effects caused, it’s no surprise people noticed something was up.

Thankfully the cause of the leak has (seemingly) been identified.

Missed Garbage Collection

GNOME developer Georges Basile Stavracas is the one diving headfirst in to the issue in order to root out and wrestle down where the ‘leak’ is coming from.

And in a detailed overview of his tests, checks, and findings shared on the Gitlab bug report for the issue, it seems he’s found the cause: “…something is going on with the Garbage Collector.”

What is Garbage Collection in Software?

‘Garbage Collection‘ is a form of automatic memory management (according to Wikipedia), whereby “…the garbage collector […] attempts to reclaim memory occupied by objects that are no longer in use by the program.”

“Triggering garbage collection was able to reduce the amount of memory used by GNOME Shell to normal levels”

“This morning, after loosing all my hopes of finding this memory leak, I found a very interesting behavior that I could reproduce using these steps,” Stavracas notes.

He theorises that “…only the root object of a series of inter-dependant objects is being Gcd, and finalizing it causes its children/dependant objects to be marked to GC after the root one is collected.”

By running the garbage collector for the GJS [GNOME JavaScript Bindings] Stavracas says he was able to reduce the amount of memory used to ~250MB GNOME Shell typically “consumes” on startup.

Good news, right?

The fix is not yet released

If your english is better than mine you’ll notice that the headline is in the present progressive tense. The “fix” for this issue is not yet available.

But now that that developers have narrowed in on the cause they can work on an approbate and effective fix.

It remains to be seen if any such patch can land in time to be included in Ubuntu 18.04 LTS. But if not there’s always post-release updates.

The bug is marked as “critical” and “high” priority for both Ubuntu 17.10 and Ubuntu 18.04 LTS on Launchpad, which shows Ubuntu is concerned enough about the issue to at least advise on a remedy in time.