-
Notifications
You must be signed in to change notification settings - Fork 464
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
Memory Leak when Navigating on iOS #1403
Comments
Commented out the // const image = useImage(require("../../assets/oslo.jpg"));
// if (image === null) {
// return null;
// }
return (
<Canvas style={{ width, height }} onTouch={() => setState((i) => i + 1)}>
{/* <Fill>
<Shader source={source} uniforms={uniforms}>
<ImageShader
image={image}
fit="cover"
x={0}
y={0}
tx="repeat"
ty="repeat"
width={width}
height={height}
/>
</Shader>
</Fill> */}
</Canvas>
); |
Awesome find, @thomas-coldwell - will investigate asap. |
@thomas-coldwell - just adding some info here based on our offline discussions. A branch has been created that should fix this issue. The problem was basically a reference to a The problem was basically that the After the implemented fix we could see that the destructor started to be called again, showing that we are now releasing images correctly. |
Thanks Christian 🙌 Just a few observations I've made while running the branch so far:
|
Did a little bit more debugging and when disabling hermes (so using JSC) everything got deallocated properly if that helps us pin down the issue any further 😃 |
Thanks for the insights! We've seen that hermes GC is a bit less deterministic than JSC, maybe this is the reason? The findings you see above (both that some of these nodes not being released and that JSC seems to be working correctly) should imply that this has something to do with how Hermes captures and releases references? |
Yes I think so - in the memory graph there also seems to be a lot of "non-object from hermes" nodes holding onto the |
Seen the same thing here - but it is super hard to know what Hermes is doing here since everything is just "non-object from hermes" - without any additional information. |
In the client code you were working on - can you now still reproduce the problem (preferably on device in release mode)? If so lets get together again and track it down! |
Yeah I can still reproduce it in release mode on a physical device (iPhone 13 Pro) in the example app by opening and closing the filter example (I've actually removed the filter so it just shows the image). It seems much better in release mode and the image HostObjects do actually get deallocated at points, but overall the memory usage is still growing so there is definitely some persistent objects. Will ping you on slack 🙌 |
#1403: Fix memory leak in native DependencyManager
--------- Co-authored-by: William Candillon <[email protected]>
I am facing the same memory leak issue when using image. When can I expect fix on this? |
Hello is there any update on this issue ? Still experiencing this with the latest release on ios, everythings smooth on android |
Description
It appears as though Skia has a memory leak which is particularly noticeable when navigating back and forth between a screen with a canvas rendering a Skia image. As you can see in the below screen recording the RAM usage continuously grows and this is also apparent when running the Allocations instrument from XCode (happy to send the trace file if you can't repro it on your end).
I've been able to repro this on a physical iPhone 13 Pro and on an iPhone 14 emulator
Simulator.Screen.Recording.-.iPhone.14.-.2023-03-04.at.16.07.31.mp4
Version
0.1.176 (but I've tested as far back as 0.1.172 and can repro it there too)
Steps to reproduce
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: