Swap File Manager

Magisk KSU APatch

Swap File Manager by yashsaxena15 is a practical performance module that seamlessly allocates internal storage to act as expanded virtual RAM. This prevents the aggressive background app killing caused by low memory, offering a smoother and more robust multitasking experience.

Maximize Your Memory

Breathe new life into devices with limited physical RAM by intelligently swapping inactive background processes to your internal storage.

Multitasking Boost

Keeps more apps alive in the background. Switch between heavy applications seamlessly without enduring frustrating app reloads.

Configurable Size

Easily tailor the virtual memory size to your specific needs, whether you need a modest 1GB bump or an extensive 4GB expansion.

Automated Setup

Runs a boot script that mounts and activates the swap partition automatically during startup, ensuring zero manual intervention.

Under the Hood: Swap Initialization

On a fundamental level, Android utilizes the standard Linux kernel memory management system. When you install this module, it executes a script that allocates a large, empty file within the /data partition using the dd command.

Once the file is generated, it is formatted as swap space using mkswap and injected into the kernel's active memory pool via the swapon command. The module also tweaks kernel parameters like swappiness to dictate how aggressively the system should move idle pages from RAM to this new storage-based swap file.

# 1. Allocating a 2GB dummy file
dd if=/dev/zero of=/data/swapfile bs=1M count=2048
# 2. Setting correct permissions to prevent security leaks
chmod 0600 /data/swapfile
# 3. Formatting and enabling swap on boot
mkswap /data/swapfile
swapon /data/swapfile
# 4. Tuning kernel swappiness (example)
echo 80 > /proc/sys/vm/swappiness

Frequently Asked Questions

Yes, it can run alongside zRAM (compressed RAM). Usually, the Linux kernel prioritizes zRAM (due to higher priority assigned) because it is faster. When zRAM is full, the kernel will seamlessly fall back to the swap file on your storage block.

You can open a terminal emulator app (like Termux), type su to grant root access, and then type free -m or cat /proc/swaps. You should see the allocated swap file listed alongside your available memory.

Module Info

  • Version v2.0
  • Module By
    yashsaxena15
  • Contributors yashsaxena15
  • Source Code View Repository
  • Tags
    #Swap #Virtual RAM #Memory Management #Performance #Magisk Module #Systemless
  • Requirement
    Magisk KernelSU APatch
  • Latest Update