Skip to content

Expanding RAM with swapfile

Bùi Minh Đức edited this page Feb 22, 2024 · 13 revisions

Warning

Welcome to the danger zone! Before proceeding, please keep in mind that tempering your phone's system will void your warranty and potentially render it unbootable if done incorrectly. PROCEED WITH CAUTION AND AT YOUR OWN RISK. It's recommended to back up your data first.

Being the successor of the discontinued Firefox OS, KaiOS leverages the Gecko browser engine as its core and inherits the properties of running apps based on light-weight web technologies. As such, the operating system can deliver performance comparable to other fully-featured OSes, while having as much as 1GB of RAM; and unlike basic operating systems like S30+, it can also handle multiple processes at once.

But likewise with other OSes, there's a limit on how much the phone can handle before it starts killing processes to avoid RAM overflow, and by default it has nearly reached that limit; Linux kernel already takes ~200–250MB. To resolve this issue, KaiOS compresses some of the saved data into a zRAM image that lives inside of the RAM itself. While the resulting zRAM image is fast, it reserves about half of the RAM space, leaving just the other half for active tasks. Once the memory is full, a kernel module called low_memory_killer kicks in and terminates processes in the order of priority.

Creating a swapfile on your phone's internal storage and direct it to use the swapfile instead of in-built zRAM should free that space on your RAM, leaving room for more processes and possibly make the phone faster and more capable.

Working on it...