Breaking it up is not impossible, but tricky. Running it in a separate thread wouldn't accomplish anything since it needs to hold the interpreter lock.
One could do a gc that only takes a randomly chosen thing and follows references from it. If it turns out that there are no external references then it's freed. This way the gc only inspects a small part of the linked lists in every run and it no longer takes linear time wrt the total number of allocated things.
There are problems with this approach, though. One is to tune the gc intervals to ensure that the gc isn't "starved", i.e. that garbage is generated at such a rate that the gc never manages to complete a single run through all things. Weak references are also tricky to solve; it's probably necessary to add an extra refcount field and a flag in every gc handled thing.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-04-05 16:15: Subject: Predictable gc == manual
It isn't possible to break up the gc() routine or run it in another thread, is it?
/ Mirar