内存快照
1.0 · GitHub
More about this app
On-device Android memory observer: per-app/process PSS tracking, snapshot save and compare, with data gathered via Shizuku or root.
中文 | English
Memory Snapshot
Monitor Android app memory, capture snapshots, and compare memory usage across points in time.
What is it?
Memory Snapshot is a local Android memory monitoring tool. It uses Shizuku or Root to collect system-level memory data, presents usage by app and process, and saves any sample as a snapshot for later management and comparison.
It can help you observe memory before and after an app action, spot continuously growing usage, compare different app versions or test scenarios, and understand how memory is distributed across the apps on a device.
Features
- Live monitoring: Continuously scans installed apps and shows their icon, name, package, running state, process count, and memory usage.
- Memory details: Inspect TOTAL PSS, Java Heap, Native Heap, Code, Stack, Graphics, Private Other, System, TOTAL RSS, and swap-related metrics.
- Per-process views: Switch between all processes and an individual process, with its PID, usage, and share of the app total.
- Search and filters: Search by app name or package, separate user and system apps, or show only running apps.
- Flexible sorting: Sort by name, TOTAL PSS, individual memory regions, or comparison metrics in ascending or descending order.
- Snapshots: Save any number of samples, inspect or rename them, enter multi-select with a long press, and delete them in batches.
- Snapshot comparison: Select multiple snapshots for both baseline and target groups; multi-snapshot groups are compared using their averages.
- Change detection: See app and process deltas, including newly installed, uninstalled, started, and stopped states.
- JSON import and export: Use the Android system file picker, select snapshots and app categories, and review imported snapshots before confirming.
- App management: Open the system app-info page or stop an entire app or selected process using the active access method.
- Chinese and English UI: Follow the system language or manually select Simplified Chinese or English.
Memory metrics
Memory Snapshot uses TOTAL PSS as its primary usage metric. Shared pages are distributed proportionally, making PSS more suitable than a direct RSS sum when comparing memory pressure across apps.
| Metric | Meaning and relationship |
|---|---|
| TOTAL PSS | The primary app memory metric and the default basis for snapshot totals and comparisons. |
| Java Heap / Native Heap / Code / Stack / Graphics / Private Other / System | The seven regions that make up TOTAL PSS. Their sum equals TOTAL PSS. |
| Resident PSS | The PSS currently resident in RAM. It equals TOTAL PSS minus TOTAL SWAP PSS. |
| TOTAL SWAP PSS | Swapped pages distributed proportionally among sharers. It is already included in TOTAL PSS and must not be added again. |
| TOTAL RSS | Counts resident pages at full size. Shared pages may be counted repeatedly across processes, so this is a reference metric. |
| TOTAL SWAP | An undistributed swap metric exposed by some older Android versions and shown for reference only. |
Available fields vary by Android version and vendor. Missing reference metrics are omitted. Values also change continuously with process activity, memory reclamation, and sample timing.
Access methods
| Method | Best for | Requirements |
|---|---|---|
| Shizuku | The default method; does not require a rooted device | Install and start Shizuku, use Shizuku API 12 or later, and authorize Memory Snapshot. |
| Root | Rooted devices | A working Root shell and authorization from the device's Root manager. |
Both methods are used to read system memory data and perform app or process stop actions. You can switch between them in Settings. Stopping an app or process may discard unsaved data.
Monitoring behavior
- Sampling runs continuously on background threads while the app is open; expensive scans are not performed on the main thread.
- Available update intervals are
3 / 5 / 10 / 15 / 30 / 60seconds. The next countdown begins only after the current scan finishes. - Returning to the foreground triggers an immediate refresh and resumes continuous monitoring.
- Background monitoring can stop immediately, after
15 / 30 / 60seconds, or after3 / 5minutes. - Closing the app ends monitoring and its privileged session completely. The app does not provide persistent monitoring across a device reboot.
Privacy and data
- The app does not request network access. Sampling, snapshots, settings, and comparisons remain on the device.
- Package visibility is used only to list installed apps and associate them with memory data.
- Snapshots are stored in a local Room database, while settings use DataStore.
- JSON import and export use Android's system file picker and require no legacy storage permission.
- App icon bitmaps are not stored in the snapshot database or JSON. Imported data uses the installed app's current icon when available and falls back to a default icon otherwise.
- Import files are validated and previewed before anything is written to the database.
Exported JSON contains package names, process names, and memory data from the selected snapshots. Treat it as a device-information file and store it appropriately.
Getting started
- Install and open Memory Snapshot.
- Choose Shizuku or Root in Settings and grant access.
- Open the Live screen to inspect current app and process memory.
- Select Record snapshot to save the current sample, then manage it from Snapshots.
- Select baseline and target snapshots in Compare to inspect app and memory-region changes.
Requirements
- Android 7.0 (API 24) or later.
- Shizuku API 12+, or a rooted device with a working Root shell.
- A system that exposes the required
dumpsys meminfoand/procdata. Completeness may vary between Android distributions.
Tech stack
- Kotlin
- Jetpack Compose + Material 3
- Kotlin Coroutines / Flow
- Shizuku / libsu
- Room / DataStore
- Navigation 3
- Kotlin Serialization
Build from source
The project requires JDK 17, the Android SDK, and the API 36 build tools.
./gradlew :app:assembleDebug
The generated APK is located at:
app/build/outputs/apk/debug/app-debug.apk
Run unit tests with:
./gradlew :app:testDebugUnitTest
Note
Memory Snapshot reports system samples intended for observing trends, distribution, and relative changes. They should not be treated as an exact measurement of physical memory exclusively owned by an app.
How Shizuku is used
Can track per-app memory use via `dumpsys meminfo`, stop apps via `am force-stop` and kill processes via `Os.kill` through Shizuku.
This is an AI-assisted analysis of Shizuku-related usages in the app's public source code. It is best effort, so it may not catch every single usage.
How this app uses Shizuku
Shizuku runs a privileged sampler that collects system memory info and manages running apps and processes.
- Track live memory use: continuously scans all running processes and shows per-app and per-process PSS memory, gathered with the
dumpsys meminfosystem command through Shizuku plus process UID lookups. - Stop running app: stops a selected app completely using the
am force-stopsystem command through Shizuku, then refreshes the memory list. - Kill app process: terminates selected processes of a running app with a system kill signal through Shizuku after verifying the process still belongs to that app, then refreshes the memory list.
Android APIs or commands used
dumpsys meminfo -s -S --localam force-stop --userandroid.system.Os.killandroid.system.OsConstants.SIGKILL
Changelog
What's new for version 1.0
首个版本,功能基本完善
下载apk体验,如果你也正在体验澎湃OS4,也可以下载.json文件导入快照对比内存变化
First version,All functions are basically complete
Download the APK to experience it. If you are also experiencing Xiaomi HyperOS 4, you can also download the .json file and import a snapshot to compare memory changes.
Permissions
3 permissions requested