Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Right now, it's not possible to reclaim used memory from a
World
. Memory allocated to anyBlobVec
is only released after it grows beyond it's current capacity.Solution
Implement
BlobVec::shrink_to_fit
and work the way up toWorld
.World::shrink_to_fit
can be quite expensive to use, so it's not automatically used anywhere. Users can use this in an exclusive system periodically or at opportune moments (i.e. a loading screen) to release the memory used in ECS storage.Changelog
Added:
World::shrink_to_fit
to allow users to release any unused memory not currently used by the World's ECS storage.