-
Notifications
You must be signed in to change notification settings - Fork 192
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 file read memory leak #750
Conversation
Ah! I remember this. I actually did this change. |
What about
|
I think the best choice then is make_unique_for_overwrite like so: |
I also remember trying to use make_unique_for_overwrite, but I don't remember why I didn't use it in the end. I think it wasn't available on some platforms, let's see |
All the workflows succeeded on my fork and according to this it should be well supported |
Please fix the license |
Fixed a memory leak in file.cpp that happened because we were storing a raw pointer in a unique pointer and never freeing it, making the unique pointer useless. This makes it so that the memory is actually handled by the unique pointer.
Before:
https://github.com/user-attachments/assets/b9bea646-71a5-4958-84c9-d287009bd0c5
You can see it increase around 3MB each transition
After:
https://github.com/user-attachments/assets/699f5b9f-84d1-443b-8c7b-e59cb36286c7
Memory still increases because of this issue but it is greatly reduced.
If we also workaround that issue:
https://github.com/user-attachments/assets/d6c009c0-ba21-4a3f-8776-db54ea10ef42
But I didn't submit that workaround since it may break games.