- Performs most marking concurrently with the application
- Uses incremental updates to track new references
- Reduces pause times but has higher overhead
- More complex than the current implementation
- Divides heap into equal-sized regions
- Collects regions with most garbage first
- Provides more predictable pause times
- Would require significant restructuring of heap layout
- Uses colored pointers
- Performs concurrent operations without stop-the-world pauses
- Scales well to large heaps
- Very complex to implement in assembly
Call init_gen_gc
at program start
This sets up three generation spaces:
- Eden (4MB) new allocations
- Survivor space (16MB) for young surviving objects
- Tenured space (44MB) for long-lived objects
Allocation:
Objects are initially allocated in eden space
ALLOC_STRING 32 // Allocate 32-byte string
ALLOC_ARRAY 100, 4 // Allocate array of 100 integers
- Use
GEN_ALLOC
macro for basic allocation - Helper macros like
ALLOC_STRING
andALLOC_ARRAY
for specific types.
Root registration:
bl register_thread_roots // Register current thread roots
- Registers thread roots (stack, registers)
- Registers global roots
- GC tracks them to find live objects
Collection Triggers:
- Minor GC happens automatically when eden fills
- Objects surviving multiple minor GCs promote to tenured space
- Full GC triggers when tenured space fills
- Fast allocation in eden space
- Much faster minor collections since most objects die young
- Age-based promotion policy (eden -> survivor -> tenured)
- Better cache locality in the nursery
- Reduced pause times as full collections are less frequent
- Reduced write barrier overhead
(go back)