Implement rudimentary garbage collection.