Skip to content

feat(android): move getMemoryUsage() to background thread - #45

Open
Redseb wants to merge 1 commit into
Nodonisko:mainfrom
Redseb:mz/android-memory-background
Open

Redseb wants to merge 1 commit into
Nodonisko:mainfrom
Redseb:mz/android-memory-background

Conversation

@Redseb

@Redseb Redseb commented Oct 12, 2026

Copy link
Copy Markdown

What

Makes the Android memory read run on its own background HandlerThread instead of the main looper

Why

On Android, the toolkit reads /proc/<pid>/smaps_rollup every 500ms (HybridPerformanceToolkit.collectUsedRam), and it did so on the main looper. While testing on a physical device (Realme 6), each read took about 57ms of UI-thread CPU, which equated to roughly 5 dropped frames when it landed during a scroll or animation. Moving the sampling to a background thread reduced the idle UI-thread CPU usage

@Redseb

Redseb commented Oct 12, 2026

Copy link
Copy Markdown
Author

Hi, hope this change fulfills the contributing requirements - happy to discuss! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant