Files
openclaw/apps
Kaneki 1e98dbcad3 Android: fix Bitmap memory leaks in PhotosHandler (#41888)
* Android: fix Bitmap memory leaks in PhotosHandler

Bitmaps created by decodeScaledBitmap and intermediate scaled copies
inside encodeJpegUnderBudget were never recycled, leaking native memory
on every photos.latest invocation (up to 20 bitmaps per call).

- latest(): wrap bitmap usage in try/finally to guarantee recycle
- decodeScaledBitmap(): recycle the decoded bitmap after scaling
- encodeJpegUnderBudget(): use try/finally to recycle intermediate
  scaled bitmaps on all exit paths (success, compress failure, and
  cannot-shrink-further early returns)

Made-with: Cursor

* Android: guard decodeScaledBitmap against scale() exceptions

* fix: note Android photos bitmap cleanup (#41888) (thanks @Kaneki-x)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-03-22 08:53:26 +05:30
..
2026-03-21 01:10:29 -05:00