| Home Page | Recent Changes | Preferences

# Garbage Collection

Garbage is an unused part or element of code to which memory was allocated, (some resource of a program, or process), and, subsequently, has no pointers to it or has had its references destroyed. Garbage does no damage to a program initially, but it will gradually monopolize all available memory and the system will tend to run slower and slower and eventually fail or crash. Garbage collection involves running a program periodically that identifies and collects all garbage and frees memory (for more garbage). All objects and actors in Unreal are garbage-collected using a tree-following garbage collector similar to that of the Java VM.

Garbage Collection in Unreal essentially consists of serializing all Objects in the game (that includes Actors too, of course), and then deleting anything that doesn't end up being serialized. Full Garbage Collection in Unreal occurs automatically at a level change, or can be forced with a console command. Generally since most Objects are relatively small, the overhead for having the Objects stay around in memory is also relatively small (with the gluttonous UWindowWindow being an exception of course).

## Related Topics

- Destroying Objects
- Automatic garbage collection

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In