How does garbage collection affect heap memory in Java?
Garbage collection cleans up heap memory by freeing up space for new objects, but it doesnâ€™t always happen immediately.
Well done! You've got the general idea of how garbage collection works in the heap.
Can you explain how the heap memory is divided and why fragmentation might occur during long-running applications?