High Transient Mem allocations from NativeReanimatedModule::scheduleOnUI #6738
Unanswered
fredyvilla
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I am encountering a significant memory allocation spike (116MB) during the execution of NativeReanimatedModule::scheduleOnUI, particularly when scheduling and running worklets on the UI thread. The issue seems to be more pronounced with the Hermes JSI runtime, likely due to the creation of temporary JSI objects and the use of jsi::Scope.
Here’s a summary of my observations:
The memory spike occurs when multiple worklets are scheduled in quick succession.
The spike correlates with temporary JSI object creation, as indicated in the implementation of NativeReanimatedModule::scheduleOnUI:
On profiling, these objects are eventually garbage-collected, but the transient memory usage during this phase is high and can trigger memory pressure or even crashes on low-memory devices.
Are there best practices for batching or throttling worklet scheduling to reduce transient memory usage?
Would you recommend any specific patterns to control how and when the uiWorkletRuntime is invoked?
Are there existing or planned configuration options to mitigate memory spikes caused by scheduleOnUI?
I'm running version 3.15.4 and RN 0.72.6
Thank you for your help!
Best regards,
Fredy Villa
Beta Was this translation helpful? Give feedback.
All reactions