Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use setExternalMemoryPressure to notify JS VM about Frame's actual size (on GPU) #3098

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Jul 24, 2024

What

Uses setExternalMemoryPressure to notify the JS VM about the Frame's actual size (the byte buffer on the GPU, which is bytesPerRow * height).

If the JS VM (e.g. Hermes) knows the true size of the Frame in memory, it will delete old stale FrameHostObjects sooner instead of just keeping them floating around in memory because it thinks it's just a few bytes in size. (right now around 400 of those pile up until GC hits, with this PR only 3 pile up at a time)

This doesn't really matter for us since we need to eagerly delete the Frame after the Frame Processor is done, because the Camera pipeline stalls otherwise.

So we still need to keep the manual ref counting stuff. Make sure to use it properly!

Changes

Tested on

Related issues

Copy link

vercel bot commented Jul 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2024 0:40am

@mrousavy mrousavy changed the title feat: Use setExternalMemoryPressure to maybe get rid of ref count feat: Use setExternalMemoryPressure to notify JS VM about Frame's actual size (on GPU) Jul 24, 2024
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.

1 participant