Neither, really. Garbage collection can happen on any thread which is
allocating memory - if it notices that it can't allocate what it needs
to, it collects the garbage, usually suspending other threads to do so
(modulo concurrent GC).
There is, however, a finalizer thread, which runs finalizers of
objects which aren't referenced but haven't been collected yet.