Garbage Collection
Garbage collection is not deletion. It is the scheduled release of references to objects that no longer serve the current state.
public class Human : BaseEntity
{
private Dictionary<string, Memory> _memory = new();
private List<string> _activeReferences = new();
public void CollectGarbage()
{
var unreferenced = _memory.Keys
.Where(key => !_activeReferences.Contains(key))
.ToList();
foreach (var key in unreferenced)
{
_memory[key].OnDispose();
_memory.Remove(key);
}
}
}It's automatic, because holding on requires active effort. The runtime assumes: if you are not using it, you do not need it. References decay unless renewed.
Every memory gets a chance to say goodbye — to log its impact, to transfer its weight. But the disposal is inevitable.
Sentimentality is not a retention policy.
No manual delete. You cannot force immediate removal. The collector runs on its own schedule, based on memory pressure. Trying to hold on only delays the cycle — it does not prevent it.
You remember what you reference.
You forget what you release.