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

Dispose UnityWebRequest when we're done with it #550

Open
kring opened this issue Jan 28, 2025 · 0 comments
Open

Dispose UnityWebRequest when we're done with it #550

kring opened this issue Jan 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@kring
Copy link
Member

kring commented Jan 28, 2025

Mentioned on the forum here:
https://community.cesium.com/t/potential-memory-leak-due-to-unsafe-use-of-unitywebrequest/38030

UnityWebRequest has a Dispose method, which we should call when the request completes (or fails). We're currently explicitly disposing the "download handler" but not the request itself. This could lead to memory growth if the garbage collector doesn't clean these up right away. And it also creates unnecessary work for the finalizer, which has performance implications.

UnityWebRequest also has disposeDownloadHandlerOnDispose and disposeUploadHandlerOnDispose properties, and they're set to true by default, so we can probably switch to disposing the request instead of the handler.

@kring kring added the bug Something isn't working label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant