mirror of
https://github.com/yuga-hashimoto/openclaw-assistant.git
synced 2026-08-14 08:02:00 +00:00
Wraps snapshotPngBase64/snapshotBase64 in nested try/finally blocks to ensure Bitmap.recycle() is always called, preventing native memory leaks on each snapshot invocation.
1.4 KiB
1.4 KiB
-
Explore the upstream repo
- Use
git cloneor fetch to investigate recent commits inapps/android. - Find candidate commits for porting (e.g., bug fixes, memory leaks).
- Exploration complete.
- Use
-
Choose a suitable improvement
- Identified upstream commit
2909d8cd12("Android: fix Bitmap memory leaks in CanvasController snapshots"). - This prevents memory leaks caused by not recycling Bitmaps (
bmpandscaled) duringsnapshotPngBase64()andsnapshotBase64()inCanvasController.kt. - Verified that
CanvasController.ktin this repo has the exact same leak.
- Identified upstream commit
-
Port the improvement
- Modify
app/src/main/java/com/openclaw/assistant/node/CanvasController.kt. - Update
snapshotPngBase64()andsnapshotBase64()to wrap operations intry...finallyblocks, ensuringbmpandscaledare correctly recycled if they differ. - Use
replace_with_git_merge_diffto modify the file.
- Modify
-
Run Native Validation Commands
- Run
app:lintStandardDebugandapp:testStandardDebugUnitTestwith the./gradlewcommand to verify compilation and prevent regressions.
- Run
-
Complete pre-commit steps to ensure proper testing, verification, review, and reflection are done.
- Run
pre_commit_instructions.
- Run
-
Submit PR
- Use the
submittool to create a PR named🔄 Upstream Parity: Fix Bitmap memory leaks in CanvasController snapshotsdetailing the source, why, adaptation, and verification.
- Use the