iOS memory leak when using BlurMask inside animated Path
Description
When rendering a BlurMask inside an animated path, we're seeing a memory leak on iOS. This change to the example app reproduces the issue.
This shows the memory usage without and with the BlurMask:
When the BlurMask is included from the beginning, the memory usage is different, but still shows the slow increase over time:
React Native Skia Version
2.2.18 (latest)
React Native Version
v0.78.0 (used in example app)
Using New Architecture
- [x] Enabled
Steps to Reproduce / example repo
See https://github.com/jzaefferer/react-native-skia/commit/2fbef27414def5fcf96133e74ffabef1b04eaf26 - opening the new screen with the XCode debugger attached shows the memory usage increasing over time.
Thank You for filing this. What do you think the leak is? it is not clear to me looking at the report.
On Mon, Sep 22, 2025 at 1:34 PM Jörn Zaefferer @.***> wrote:
Description
When rendering a BlurMask inside an animated path, we're seeing a memory leak on iOS. This change to the example app reproduces the issue.
React Native Skia Version
2.2.18 (latest)
React Native Version
v0.78.0 (used in example app)
Using New Architecture
Enabled
Steps to Reproduce
See @.*** - opening the new screen with the XCode debugger attached shows the memory usage increasing over time.
Snack, Code Example, Screenshot, or Link to Repository
@.***
— Reply to this email directly, view it on GitHub or unsubscribe. You are receiving this email because you are subscribed to this thread.
Triage notifications on the go with GitHub Mobile for iOS or Android.
While rendering the animation, the memory usage keeps increasing. It barely decreases when navigating away from the screen.
This also happens when navigating to the screen (I've now added a back button), leaving it open for 2-3 seconds, then navigating back. Only a few mb are freed, overall it keeps increasing. Here it seems to settle around 730 MB:
When I remove the BlurMask, but leave everything else as is, the memory usage is pretty constant, both when navigating back and when leaving it running:
Does that answer your question?
PS: It's curious that the increase seems to settle at some point. I don't know what to make of that.
I'm struggling to understand the issue fully. Memory continuously going up is not necessarily a sign of a memory leak—the garbage collector decides when to delete objects, and it's been my experience that even when navigating away from a screen, objects don't always get deleted immediately.
If there is a genuine leak here, this would need a deeper investigation. I hope you don't find my answer too frustrating. I'm spending a lot of time on these issues and working to get a better grasp of how Hermes works—it's definitely been a learning process. That being said, these issues are very difficult to diagnose in other systems (non-React Native) as well.
I can very much relate to that! I'd like to contribute more here, but got way to little knowledge and experience with this kind of issue.
I spend some time looking at the memory thingy in XCode Instruments. That claimed there was an ongoing leak, but otherwise the information told me absolutely nothing.
If it could help, I can run that again and share it here.