No matter how much RAM manufacturers pour into their smartphones, we've all experienced Android killing background apps a little too relentlessly. At best, it might mean relaunching your last-played song on Spotify, or reloading a tweet on Twitter, but in some cases, you might end up losing unsaved data. With an upcoming change to Android 13 currently in testing, Google might finally be ready to improve how memory management works.

The folks at XDA Developers spotted a new commit on the Android Gerrit that follows through on some changes the company has been working towards on Chrome OS. Google is working to implement MGLRU, or "Multi-Generational Least Recently Used," as a policy on Android. After initially rolling it out to millions of Chrome OS users, the company has merged it into Android 13's kernel, potentially readying to expand its reach to countless smartphone owners.

This sort of memory management is a fairly complicated process — whether you're looking at Android specifically or Linux as a whole. Though Mishaal Rahman at Esper.io offers a much more thorough look into what multi-generational LRU really brings to the table, here's a super simplified explanation. Instead of having two lists of services (active and inactive), MGLRU uses "generations," which allow for additional tiers than just the simple two-list approach. Once implemented, Android will look to clear pages from the oldest generation first, potentially making better choices about what should be killed silently in the background, resulting in improved performance overall.

According to archived Linux entries by a senior software engineer at Google from January, the company has already started testing this sort of memory management with about a million Android devices, though as XDA points out, those numbers likely point to Android Runtime on Chrome OS — not smartphones. Still, early results sound promising:

Google's fleetwide profiling shows an overall 40% decrease in kswapd CPU usage, in addition to improvements in other UX metrics, e.g., an 85% decrease in the number of low-memory kills at the 75th percentile and an 18% decrease in rendering latency at the 50th percentile.

Decreased kswapd (which manages virtual memory) usage should return improved CPU performance, which is great for any device from low-end models to flagships, but it's the low-memory kill numbers that have us excited. It's possible this change doesn't arrive in Android 13, though it's certainly being prepared for a future version of the OS. A second Gerrit commit points to the ability to enable MGLRU using ADB commands, so who knows — maybe we'll get to try this out once the upcoming Android 13 beta program is live.

UPDATE: 2022/04/22 13:00 EST BY WILL SATTELBERG

More details

Esper.io's Mishaal Rahman has published an in-depth exploration into exactly what MGLRU means for Android moving forward — including a super helpful explanation of how memory and page management works in full. It's the perfect weekend read, but it also fills us in on some extra details concerning what these changes mean for Android moving forward.

First off, it sounds like the biggest impact MGLRU will have for smartphones will target low-end devices — gadgets without a ton of RAM that can struggle under intense workloads. Your next Galaxy S device will probably have plenty of overhead to keep managing apps and other background services without having to rely on these changes. That said, it's not impossible for flagship phones to see improvements from this — we'll just have to wait and see what impact is truly made.

Second, you might have to pick up a new device to try it. While Rahman does suggest Google plans to try out MGLRU on the Pixel 6 series, you'll likely need to pick up a phone that includes Android 13 pre-installed. This change in memory management requires an updated Linux kernel, and thanks to the Google Requirements Freeze program, many older phones won't get it.