Skip to content

Fixed crashes due to large images. - #14

Merged
surajkumar merged 8 commits into
mainfrom
fix/OOM-crash-fix
Jun 14, 2026
Merged

Fixed crashes due to large images.#14
surajkumar merged 8 commits into
mainfrom
fix/OOM-crash-fix

Conversation

@AdiK5050

@AdiK5050 AdiK5050 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Issue

  • Earlier, the ImageSelector used to load full image in the memory which led to OutOfMemoryError and eventually an app crash for larger images.

Fix

  • The Image doesn't load into memory in it's actual size. Rather it's downsampled according to the current window size of the app and then returns the downsampled image which is much lower in size and will prevent OutOfMemoryError.

What Need To Be Changed?

  • nothing needs to be changed, just an optional lambda can be utilised to show state since it may take significant time to process and return the image.
  • loadingStateis the callback which passes a boolean. Since downsampling may take a few seconds, we don't want it to feel like the UI is frozen so we can use this state to show a full screen loader. It returns true when the image is downsampling and false when the downsampling is complete.

@AdiK5050 AdiK5050 changed the title Fixed crashed due to large images. Fixed crashes due to large images. Jun 14, 2026
…e simple to use and eliminate the possibility that an invalid resolution is passed.
@AdiK5050
AdiK5050 requested a review from surajkumar June 14, 2026 11:04
surajkumar
surajkumar previously approved these changes Jun 14, 2026
@surajkumar
surajkumar merged commit 5433c15 into main Jun 14, 2026
2 checks passed
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.

2 participants