ZRAM and RAM Extension (also known as RAM Expansion) are both methods used to optimize memory usage, but they work in different ways:
1). ZRAM:
•ZRAM uses compression to store data in RAM. When the system is running low on physical RAM, ZRAM compresses data and stores it in a virtual block device. This allows more data to fit into the available memory, but accessing this data is slower compared to regular RAM because it requires decompression.
•It helps in reducing the need for slower swap storage (like eMMC/SSD), improving overall system performance in low-memory situations.
2). RAM Extension:
•RAM Extension (often used on Android devices as Virtual RAM) is a process where a portion of internal storage (such as eMMC or UFS storage) is used as virtual memory when RAM is full. This is typically slower than ZRAM or physical RAM.
•It increases the total available memory by utilizing storage as an extension of RAM, but performance suffers due to the slower read/write speeds of storage compared to RAM.