Sonos interview question

How would you go about implementation a garbage collection system (while constructing, for example, a compiler)?