4 ms·
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
by kmm 15y ago
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.
- loeg 15y agoBoehm controls malloc; it knows where the heap is. In general, yes, the more memory you have allocated, the slower BoehmGC will be. It checks both stack and heap.
- cpeterso 15y agoThe 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).