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

Unbounded memory usage when an object falls indefinitely #14

Closed
sebcrozet opened this issue Sep 23, 2020 · 2 comments · Fixed by #30
Closed

Unbounded memory usage when an object falls indefinitely #14

sebcrozet opened this issue Sep 23, 2020 · 2 comments · Fixed by #30
Labels
C-Bug Something isn't working

Comments

@sebcrozet
Copy link
Member

If an object falls indefinitely, the memory usage of Rapier will increase steadily. This is likely caused by the broad-phase allocating empty grid cells traversed by the falling object.

We should see if there is a way to automatically free the empty broad-phase grid cells without any performance impact.

@sebcrozet sebcrozet added the C-Bug Something isn't working label Sep 23, 2020
@stephanemagnenat
Copy link

As a user, I would say that whether one wants to release empty cells depends on the application: if the world is bounded and small, one wants to keep empty cells to avoid repeating de-allocation and re-allocation. If the world is unbounded or large, one wants to free empty cells, possibly after a give unused time. Of course, if the de-allocation is very cheap, de-allocating cells every time a contained object counter reaches 0 seems acceptable. If it is not that cheap, maybe it is best to leave the decision to the user, either through a global flag enabling automatic freeing of empty cells, or through an explicit cell garbage collection call.

@sebcrozet
Copy link
Member Author

Letting the user decide sounds like a good idea. We can either add a parameter to the broad-phase constructor, or enable the de-allocation by default (to avoid any surprises memory-wise) and add a method to let the user disable it explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants