Device Benchmarking & Testing

Mobile RAM Management: App Retention and Memory Compression Testing

James Rivera, Mobile Software Architect • August 11, 2026 • 9 min read

12GB of RAM no longer guarantees 12 apps stay in memory. In our controlled multitasking test across four 2024-2025 flagships, the difference between the best and worst device was 19 apps retained versus 6 — with identical workloads. The reason isn't just RAM capacity. It's how aggressively the OS compresses, classifies, and kills.

We instrumented app retention, memory compression ratios, and kill behavior to answer a practical question: what actually happens after you leave an app? For users, that determines whether a game resumes or restarts; for architects, it reveals how lmkd, Jetsam, and zRAM interact under real pressure.

Why RAM Management Matters More Than Capacity

Mobile operating systems never use swap-to-disk like a desktop. Flash storage is slow, and write endurance matters. Instead, they rely on a hierarchy: keep foreground apps in fast LPDDR5, compress background pages in RAM itself, and terminate what they can't keep.

This creates three distinct pain points we measured:

  • State loss: When a background app is killed, its activity stack and WebView state are destroyed. Reload can cost 2-4 seconds and mobile data.
  • Thermal and CPU cost: Compression saves memory but costs CPU cycles. An inefficient compressor can increase jitter during scrolling.
  • Inconsistent behavior: OEM skins tune thresholds differently. Samsung's One UI historically kills more aggressively than Pixel's stock Android, even with the same chipset.

This is part of a broader system interplay. Memory pressure directly affects the mobile audio subsystem architecture — background audio services are particularly vulnerable to being reclaimed — and even impacts how efficiently subsystems like solid-state battery controllers can schedule background work.

How Android and iOS Handle Memory Differently

Both platforms prioritize the foreground, but their reclamation philosophies diverge.

Mobile Connectivity Standards Comparison
Feature 5G NR Wi-Fi 7 Bluetooth 5.4
Peak Throughput20 Gbps46 Gbps2 Mbps
Latency1–4 ms1–2 ms3–6 ms
RangeSeveral km30–50 m100–400 m
Power DrawHighMediumUltra-low
Primary UseCellular dataLocal networkingPeripherals/IoT

Android: lmkd + PSI + zRAM

Modern Android uses lmkd (low memory killer daemon) driven by Pressure Stall Information (PSI). Instead of polling, the kernel notifies lmkd when memory stalls exceed thresholds. lmkd then kills according to oom_adj_score, ranging from -1000 (persistent system) to +1000 (most killable cached app).

Categories matter more than recency. A cached app with heavy native memory (games, camera) is killed before a lightweight cached app, even if the game was used more recently.

# Check current lmkd tuning (Pixel 8, Android 14) adb shell dumpsys lmkd | grep -A 8 "kill count" adb shell cat /proc/pressure/memory some avg10=1.24 avg60=0.88 avg300=0.45 total=2849321 # oom_adj for running packages adb shell cat /proc/`pidof com.example.game`/oom_score_adj 900 # cached, killable

iOS: Jetsam + Memory Compressor + Freezer

iOS has no user-visible swap file but has a highly optimized in-memory compressor and, since iOS 15, an App Freezer. Jetsam monitors high-water marks per process. When memory pressure rises, it:

  1. Compresses inactive pages (WKCompression ~2.5:1 typical)
  2. Freezes background apps — marking their pages as reclaimable without full termination
  3. Kills by priority: extensions and background tasks first, then suspended apps by footprint

iOS is less tunable by OEMs, which explains more consistent retention per gigabyte, despite having physically less RAM. An iPhone 15 Pro with 8GB often out-retains a 12GB Android device running aggressive custom skins.

Mobile RAM Management Architecture Block diagram showing app states flowing through LMK/Jetsam to zRAM compressor and physical RAM. MEMORY HIERARCHY & RECLAMATION FLOW FOREGROUND Activity + GPU oom_adj 0-100 BACKGROUND Service / Audio oom_adj 200-400 CACHED Suspended Apps oom_adj 900+ lmkd / JETSAM PSI • High Watermark oom_adj • priority ⟶ Kill / Freeze zRAM COMPRESSOR LZ4 / ZSTD 2.1 – 2.8:1 ratio ~30% CPU cost PHYSICAL RAM LPDDR5 / 5X Active + Compressed 4–16 GB STORAGE SWAP UFS 4.0 / NVMe Rarely used ⚠ Wear risk
Fig 1 — Simplified mobile memory hierarchy. Only pages that compress well (text, UI bitmaps) benefit from zRAM; already-compressed media bypasses it.

zRAM, zSwap and Why Compression Ratio Matters

zRAM creates a block device in RAM that stores compressed pages. When the kernel needs to evict an anonymous page (heap, app data), it compresses it with LZ4 or ZSTD instead of writing to flash.

LZ4 (Android default)

Faster decompression (~600 MB/s per core), lower ratio ~1.8-2.2:1. Preferred for UI responsiveness. Used by Pixel and OnePlus in our tests.

ZSTD (Samsung, newer Pixels)

Higher ratio 2.4-2.9:1 but 15-25% more CPU. Better for heavy multitasking, worse for sustained gaming thermals.

We logged compression efficiency via sysfs during the 30-app workload:

# Real readout after 30-app cycle (OnePlus 12, 16GB) cat /sys/block/zram0/mm_stat orig_data_size 4123213824 compr_data_size 1589432320 mem_used_total 1611227136 # ratio = 4123 MB / 1589 MB = 2.59:1 zramctl NAME ALGORITHM DISKSIZE DATA COMPR TOTAL /dev/zram0 lz4 6G 3.8G 1.5G 1.5G # iOS equivalent (Xcode Instruments → VM Tracker) memory compressor size: 1.82 GB → 0.71 GB (2.56:1)

A key nuance: zRAM helps with anonymous pages, but file-backed pages (cached APKs, images) are simply dropped and re-read from storage. Devices with slower UFS show longer reloads even with identical RAM.

Power users often install memory-heavy utilities alongside their workflow. We noticed that background security tools like those analyzed in our mobile password manager security review persist better than expected because they run as foreground services with lower oom_adj — a privilege not granted to normal cached apps.

App Retention Test Methodology

We designed a repeatable, instrumented test to isolate RAM management from storage speed or network variance.

Devices & Configuration

  • Pixel 8 Pro (12GB LPDDR5, Tensor G3, Android 14, zRAM 3GB LZ4)
  • Samsung Galaxy S24 Ultra (12GB LPDDR5X, Snapdragon 8 Gen 3, One UI 6.1, zRAM 6GB ZSTD)
  • OnePlus 12 (16GB LPDDR5X, Snapdragon 8 Gen 3, OxygenOS 14, zRAM 6GB LZ4)
  • iPhone 15 Pro (8GB LPDDR5, A17 Pro, iOS 17.4, Apple Compressor)

All devices were factory-reset, updated, and set to 60Hz, adaptive battery off, and no battery optimization per-app to avoid skewed kills.

Workload

30 apps opened sequentially (10 seconds foreground each): 6 social (Instagram, TikTok, X, Reddit, Telegram, Facebook), 6 browsers/docs (Chrome 3 tabs, Google Docs, Notion, Maps), 6 games (Genshin Impact, COD Mobile, PUBG Mobile, Candy Crush, Chess.com, Roblox), 6 media/creativity (Lightroom, Snapseed, Spotify, YouTube, Camera, Gallery), 6 utilities (Gmail, Slack, Settings, Files, Calculator, Play Store).

After the 30th app, we re-opened apps in reverse order (LIFO) and recorded: retained (instant resume <800ms), reload (splash screen), or frozen (iOS only, brief decompression ~1.2s). We captured dumpsys meminfo, PSI logs, and thermal throttling concurrently. Each device ran the cycle three times; we report medians.

Testing note: Speaker volume or display brightness can indirectly affect thermals and thus compression CPU budget. For acoustic load isolation we kept audio muted; see our separate smartphone speaker volume quality test for how audio subsystems behave under sustained load.

Results: 4 Flagships Under Pressure

Device (RAM / zRAM) Apps Retained /30 Compression Ratio Avg Reload Time (killed apps) Kill Aggressiveness
OnePlus 12
16GB / 6GB LZ4
24 Best 2.59:1 1.9s Low — keeps games longest
Pixel 8 Pro
12GB / 3GB LZ4
14 Mid 2.12:1 2.3s Balanced — favors recent
Galaxy S24 Ultra
12GB / 6GB ZSTD
11 Mid 2.81:1 2.1s High — OS kills early
iPhone 15 Pro
8GB / — Apple
19* Efficient 2.56:1 1.4s (freeze) Adaptive — Freezer

*iPhone retained 12 apps fully + 7 frozen (decompressed resume in ~1.1–1.5s, no data loss). Counted as retained for user experience but technically not resident.

Key Observations

1. More RAM helps, but tuning dominates. The 16GB OnePlus kept double the apps of the 12GB Samsung, despite Samsung's superior compression ratio. Logs showed Samsung's lmkd threshold triggered at ~68% PSI stall, versus OnePlus at ~82%. Samsung trades multitasking for headroom — keeping RAM free ensures the camera can allocate 300-400MB instantly.

2. iOS Freezer is a cheat code. The iPhone never truly killed 7 of its apps; it compressed and sealed their state. Resume from freezer is slower than pure RAM but indistinguishable from retention for lightweight apps. Only 4K-heavy games (Genshin) were fully terminated.

3. Game retention is the canary. Genshin Impact (1.8GB PSS) was the first killed on every Android device. On Pixel it survived 9 app launches after backgrounding; on Samsung only 5. If you switch between a game and messaging apps, expect reloads on aggressively-tuned devices.

4. Compression ratio ≠ retention. Samsung achieved 2.81:1 with ZSTD but still retained fewer apps. High compression saved ~900MB more than Pixel, but its earlier kill policy erased the gain. Efficient policy beats efficient compression.

What This Means for Developers & Power Users

For Developers

  • Save state aggressively. Assume your app will be killed if it exceeds 350MB in background. Implement onSaveInstanceState and persist ViewModel to disk; don't rely on RAM.
  • Avoid large native allocations in background. A 200MB bitmap cache moves you to the top of lmkd's list. Release on onTrimMemory(TRIM_MEMORY_UI_HIDDEN).
  • Use WorkManager correctly. Background work scheduled as expedited jobs gets higher priority than cached apps, but abusive wake locks get flagged by App Standby Buckets.

For Users Choosing a Device

  • If you multitask with 15+ apps and games, 16GB + relaxed lmkd (OnePlus, some Xiaomi) matters more than benchmark scores.
  • If you prioritize camera readiness and battery, Samsung's aggressive killing is a feature — it keeps memory free for burst photo processing.
  • On iOS, 8GB is effectively 12GB Android-equivalent due to Freezer and unified memory. Don't compare raw numbers cross-platform.

System-wide efficiency extends beyond RAM. As we covered in our low-level teardown, memory pressure interacts with peripheral subsystems — including thermal headroom that also limits performance in other domains.

Bottom line: In 2026, effective multitasking is defined by compression policy and kill thresholds, not just the gigabyte number on the spec sheet. Test retention yourself: open your 20 most-used apps, then walk backwards. The count that resumes instantly is your device's true multitasking budget — and it's rarely what the box advertises.

Frequently Asked Questions

How much RAM do I actually need for multitasking in 2026?
For typical use (messaging, browser, maps, music), 8GB with good compression is sufficient and retains 12-15 apps. For heavy gaming plus multitasking or DeX/desktop modes, 12-16GB provides headroom. More important than capacity is how the OEM tunes lowmemorykiller thresholds.
Is zRAM the same as virtual RAM or RAM Plus?
Related but not identical. Marketing terms like RAM Plus often combine zRAM (compressed RAM) with swap-to-storage. True zRAM never touches flash and is much faster. Swap-to-storage extensions are slower and can degrade UFS endurance if overused. Most flagships use 3-6GB zRAM only.
Why does my Samsung kill background apps faster than a Pixel?
Samsung's One UI sets lower PSI stall thresholds and larger ZSTD zRAM to keep free memory for camera and AI features. It prioritizes foreground responsiveness over background retention. You can partially mitigate this by setting apps to Unrestricted in Battery settings, but system policy still applies.
Does memory compression affect battery life?
Yes, but modestly. LZ4 compression costs about 0.3-0.6% battery per hour under heavy multitasking due to CPU usage. However, it saves power versus killing and cold-relaunching apps, which requires CPU, GPU, and storage I/O. Net effect is usually neutral to slightly positive.

Continue Reading

References & Standards: USB Implementers Forum · Bluetooth SIG