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

fix(DepthOfField): cleanup memory leak #233

Merged
merged 5 commits into from
Aug 23, 2023

Conversation

dongho-shin
Copy link
Contributor

@dongho-shin dongho-shin commented Jul 29, 2023

Hi I found that DepthOfField Component has a Texture Memory leak
so I fix it in PR

you can check memory leak this codeSandbox
Every update of parameter, texture count increase infinitely

@dongho-shin dongho-shin changed the title Fix/dof memory leak Jul 29, 2023
@dongho-shin

This comment was marked as resolved.

@dongho-shin dongho-shin closed this Aug 7, 2023
@dongho-shin dongho-shin reopened this Aug 7, 2023
@talentlessguy
Copy link
Member

the code seems ok (if I got it right it mostly disposes render targets) but could you also please create a sandbox demo with new DOF code? to test out the effect that it works correctly

@dongho-shin
Copy link
Contributor Author

the code seems ok (if I got it right it mostly disposes render targets) but could you also please create a sandbox demo with new DOF code? to test out the effect that it works correctly

ok I will make it for test it

@dongho-shin
Copy link
Contributor Author

dongho-shin commented Aug 20, 2023

@talentlessguy Hi I made a code sandbox but it has a problem

Actually I fix memory leak by wrapping React Code because EffectComposer of '@react-three/postprocessing' can't get CustomEffect
so I use this way that below codesandbox
Wrapped Origin ReactComponent Version

Do you have any ideas? do i add a custom effect in wrong way?

I guess if that problem fixed, I'm quite sure it works under the sandbox
code sandbox
(custom effect didn't added in effect composer i don't know why 😢 )
BTW it works in this case (https://codesandbox.io/s/customeffect-zdcc7f?file=/src/App.tsx)

src/effects/DepthOfField.tsx Outdated Show resolved Hide resolved
src/effects/DepthOfField.tsx Outdated Show resolved Hide resolved
src/effects/DepthOfField.tsx Outdated Show resolved Hide resolved
@CodyJasonBennett CodyJasonBennett changed the title fix/dof memory leak Aug 23, 2023
@CodyJasonBennett CodyJasonBennett merged commit 49b082f into pmndrs:master Aug 23, 2023
1 check passed
@github-actions
Copy link

🎉 This PR is included in version 2.15.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants