Repository navigation
fix: bound heap spikes behind OutOfMemoryError on low-RAM devices - #46
Merged
Merged
Conversation
0.19.19 still OOMed on a Samsung A30 (Android 11, 192MB heap). The notification-extras guard stopped the fatal read, but the binder-thread stack is only the victim allocation — several unbounded paths could fill the heap first: - Wallpaper and glyph-editor image imports decoded full-resolution bitmaps (a modern photo is tens to hundreds of MB) before scaling. - The in-app browser never destroyed its WebView, leaking a renderer and page state on every visit. - HttpRequest actions drained the entire response body into memory. - Every notification post/remove re-unparceled every active notification's extras; bursts stacked the parcel churn. Decodes now go through a sampled-decode helper (~1-2k px ceiling), the browser WebView is destroyed on release, the response drain caps at 256KB, and shade refreshes debounce 500ms so bursts collapse into one unparcel pass. largeHeap is enabled for headroom on 3-4GB devices. Authored By: TDvorak <info@tdvorak.dev> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Mira PR Walkthrough❌ Review failed — click for detailsThe code review failed to complete due to an unexpected error. Stage: Code review |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two
OutOfMemoryErrorreports on 0.19.19 (44) — Samsung SM-A305F, Android 11, 192MB heap — even though the notification-extras fix from #44 shipped in this version. The binder-thread stack (ThreadLocalWorkSource.setUidinsideBinder.execTransact) is only the victim allocation: the heap was already full and fragmented, so whichever thread allocated next died.This PR caps the remaining unbounded heap paths found in the codebase:
WallpaperActionEditorandGlyphEditorScreen(image/GIF import + clipboard paste) calledBitmapFactory.decodeStream/ImageDecoder.decodeBitmapat native resolution before scaling. A 12–50MP photo is 48–200MB — instantly fatal on a 192MB heap, and the wallpaper thumbnail loads automatically when the action editor opens. NewdecodeSampledBitmaphelper bounds the decode to ~1–2K px viainSampleSize.IntegratedBrowserScreennever destroyed itsWebView; every visit kept the renderer and page state alive. NowonReleasecallsdestroy().fetchText(JSON download import) is also capped at 1M chars instead ofreadText().HttpRequestaction — drained the entire response body withreadBytes(); now capped at 256KB (disconnect()follows anyway, so connection reuse was never real).getActiveNotifications()and un-parceled every active notification's extras. Bursts now debounce 500ms; the existing generation/mutex logic still guarantees only the freshest snapshot wins.android:largeHeap="true"— raises the ceiling (~512MB) on 3–4GB devices. Headroom, not a root-cause fix — the caps above are the actual fixes.Type of change
Affected modules
Testing
./gradlew test)./gradlew :app:lintPlayDebug— 0 errors)./gradlew :app:assemblePlayDebug)Device compatibility
No Glyph/device-specific behavior changed. Most relevant on low-RAM devices (the reporting device is a 3GB Samsung A30).
Checklist
Generated with Devin