-
Notifications
You must be signed in to change notification settings - Fork 544
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
It is easy to leak mesh data #464
Comments
This could be another instance where HKT would be useful. You could either get a batch which borrows a mesh, or maybe have an Rc pointer to a mesh... dunno how that would work though... :S |
Woops, thanks @cmr! |
I'm running into this right now. 100% memory usage after 10 mins using my library. The main issue is that I'm basically getting a mesh and then throwing it away immediately. Is there a better way to do this or is there a way to delete meshes? |
To delete a mesh:
|
(Although I think this will still leak VAOs, I don't remember) |
@cmr That code snippet doesn't work, but this compiles:
But now my program crashes with
|
This is apparently happening when I call Full stacktrace:
|
Looks like you deleted the mesh buffers and then executed a draw list that used them. We should not allow that, ideally... |
I think we could add a reference count to buffer/texture ect. This would let us track of the buffer was still in use and would be freed automatically when the user no longer had access to the buffer and the buffer had flushed its way through any pending draw lists. If the user wants to reuse the same buffer between frames to avoid allocation, this model would naturally work. The down side is that it adds considerable overhead to the buffer objects. You need a reference count and a pointer back to device in order to free the the buffer when it is done. There is also a trade off between |
What I was thinking is: we could have a backend-agnostic wrapper around the device (might as well just be our |
Actually, the problem with stand-alone resource deletion is not just conceptional integrity of the device. It also needs to fix/notify whatever caches that rely on the resource. This might be compatible with |
Just re-capping the possible scenarios of our unsafe resource handling:
So far it looks like @csherratt proposal mostly solves it. It would be nice to have it as an option. Also related to #530, cc @dylanede, @XMPPwocky |
This should probably be detection only. I don't think we should hold onto a large mesh or texture for longer then we need to. |
It is partially addressed by #633 |
Radically fixed in #757 |
Not sure how to fix this.
The text was updated successfully, but these errors were encountered: