Skip to content

Conversation

@kirillzyusko
Copy link
Contributor

Summary

We were facing OOM crash.

It happens because we load whole file into memory to get its size:

let imageData = NSData(contentsOfFile: absoluteImagePath)!

In this PR I'm using CGImageSourceCreateWithURL to avoid loading whole file into memory until it's really needed.

Also added more guards and removed ! operators (which eventually may lead to silent crashes and don't propagate error to JS).

Changelog

[ios] [bugfix] - use CGImageSourceCreateWithURL to avoid OOM crash

Test Plan

Try to load 1000 RAW images simultaneosly and get size of all of them via Promise.all([getImageMetadata...])

Copy link
Owner

@numandev1 numandev1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@numandev1 numandev1 merged commit 713c57f into numandev1:main Jan 6, 2026
@numandev1
Copy link
Owner

released in 1.14.0

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