Mobility

How to prevent a Chromebook from running out of memory

If you find your Chromebook running out of memory when the job needs to get done, here's an easy fix for that frustrating problem.

Image: Jack Wallen

If you're a heavy Chromebook user, and you find your device constantly giving you an "out of memory" error, or if you find data in older browser tabs simply disappearing, your device doesn't have enough memory to handle your workload. Fortunately there's a way to fix this.

This often occurs on lower-end Chromebooks with 2GB of memory; but even those with 4GB aren't guaranteed to not suffer from the issue. And so when it happens to you, what is there to be done?

You use zram (otherwise known as compressed cache - compcache). With a single command you can create enough zram to compensate for your device's lack of physical RAM. You can create as much compcache as you need; but remember, most Chromebooks contain smaller internal drives, so create a swap space that doesn't gobble up too much of your physical drive (as swap is created using your Chromebook internal, physical drive).

To create compcache, you must work within Crosh (Chromebook shell), aka the command line. Believe it or not, the command use for this is incredibly simple; but the results are significant (especially in cases where you're frequently running out of memory).

It should be said that this is still considered an experimental feature, so use it with caution when working with important files. I've used swap consistently without issue, but mileage may vary.

Getting to Crosh

The first thing you must do is open a Crosh tab. This is simple and doesn't require anything more than hitting the key combination [Ctrl]+[Alt]+[t]. When you find yourself at crosh> (Figure A), you know you're ready to go.

Figure A

Figure A

The crosh window on a Chrome Pixel.

The command to create swap space is very simple and comes in the form of:

swap enable SIZE

Where SIZE is the size of the swap space you wish to create. The ChromeOS developers suggest adding a swap of 2GB, which means the command would be:

swap enable 2000

Once you've run the command, you must then reboot your Chromebook for the effect to take place. The swap will remain persistent until you run the disable command (again, from Crosh), like so:

swap disable

No matter how many times you reboot, the swap will remain until you issue the disable command.

An easy fix for a frustrating problem

When you're trying to get your work done, the last thing you need is to have your device inform you it lacks the resources for the task. Fortunately, this easy fix will take care of that rather frustrating problem. Give swap space a try on your Chromebook and see if it keeps you working.

Also see

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox