Garbage

From TinyMUX
Jump to navigation Jump to search

Garbage refers to non-existent objects, and the type of such objects. As a subject, it seems to easily confuse the uninitiated. It is primarily the absence of being anything else, and therefore to get rid of it, you must create something. When you @dig a Room, @pcreate a Player, @open an Exit, or @create something, the server first looks for an available dbref in the pile of Garbage. If there is no Garbage, it extends the database.

First realize that the server shows an unused dbref as Garbage. It has no attributes, it is not saved to the disk. The only space it requires is the emptiness of a dbref record waiting to be used for some other purpose. All Garbage objects are owned by #1 under the covers, but the server does its best to hide the fact that they exist at all.

The server doesn't find Garbage, will not let you move it, set any attributes on it, enter it, or anything else. Garbage is off limits. If you happen to find a way to play with Garbage, it is a bug, and you should report it. Playing with Garbage has historically been a large source of crashing bugs.

New objects are assigned the lowest available dbrefs, and over time as objects are @destroyed and new objects are created, the pile of garbage will tend to collect at end of the database. In many codebases (including TinyMUX), a @restart will automatically shrink the database and forget about any garbage at the end of the database. Garbage caught in the middle of the database will remain.

A brief discussion about the disadvantages of having a lot of Garbage (at least on PennMUSH, but potentially accurate on other codebases as well) can be found in this entry on the PennMUSH Faq-O-Matic.