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

World Garbage Collection / Compaction #4781

Open
james7132 opened this issue May 17, 2022 · 2 comments
Open

World Garbage Collection / Compaction #4781

james7132 opened this issue May 17, 2022 · 2 comments
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible C-Performance A change motivated by improving speed, memory usage or compile times

Comments

@james7132
Copy link
Member

What problem does this solve or what need does it fill?

Resources allocated to a World are currently never reclaimed (except Entity ID space`). This includes memory allocated in BlobVec / Column, empty archetypes, empty tables, etc. These unused resources may add extra work over time. Processes that scale with the number of archetypes, tables, or entities will grow slower as more varied gameplay situations are encountered.

What solution would you like?

Either a manual World::vacuum that uses exclusive access to reorder and collect unused memory and ID space, or some behind the scenes book-keeping that gradually collects unused resources.

What alternative(s) have you considered?

  • Letting the memory and ID space pile up persistently.
  • Naive garbage collection #4762 is a very naive implementation for this that halts the entire app to collect unused memory, and is typically inefficient due to the potentially large reallocations done.
@james7132 james7132 added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times and removed S-Needs-Triage This issue needs to be labelled labels May 17, 2022
@mockersf
Copy link
Member

It would be nice to have metrics (possibly as diagnostics) on usage (memory, number of archetypes, ...) before trying to clean up

@james7132
Copy link
Member Author

On this note, #4832 was opened to automatically clean up event storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible C-Performance A change motivated by improving speed, memory usage or compile times
Projects
None yet
Development

No branches or pull requests

2 participants