bevyengine / bevyengine/bevy

World Garbage Collection / Compaction

Open
#4,781 2 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Feature C-Performance
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## 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.
- #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.

Contributor guide

Open the contributing guide

Research direction

Start with the World, BlobVec, and Column resource-management code, then review the proposed World::vacuum approach alongside issue #4762. The issue is complete when unused memory, empty archetypes and tables, and Entity ID space can be reclaimed without the inefficiency or full-application halt described for #4762.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.