Paul Robinson wrote:

> I don't see how the garbage collector would help.

No?  That's exactly what it's for.

> How would it know which objects were 'dead' and could be removed?

There are many techniques, and it's such a general question I'd rather
not go into it here.  If you Google "how do garbage collectors work"
(preferably sans quotes), you'll get a ton of hits that will tell you
more than you ever wanted to know.

-Dave

-- 
Dave Aronson, the T. Rex of Codosaurus LLC (www.codosaur.us);
FREELANCE SOFTWARE DEVELOPER, AVAILABLE AS OF MARCH 1st 2014;
creator of Pull Request Roulette, at PullRequestRoulette.com.