I've often wondered how a garbage collector can scan the entire memory in a reasonable time. The article doesn't explain that particular operation. With a quick look at the source code I couldn't figure it out either.
Can anyone enlighten me? Is it only the stack that is checked because that seems possible in a reasonable time.
The GC doesn't have to scan the entire address space. It starts scanning with GC roots, memory regions known to contain pointers such as stack, heap, and global variables (registered with the GC).
Can anyone enlighten me? Is it only the stack that is checked because that seems possible in a reasonable time.