Amazon Interview Question

Describe how the Java garbage collector works

Interview Answer

Anonymous

Jan 17, 2013

Garbage collector is very misunderstood. People think its a resource clearing engine. Not true. Its more for defragmentation of memory so that the system keeps running efficiently. Otherwise, you get thrashing going on and the memory manager keeps working hard in order to find allocatable chunk of memory. This is especially true in systems with lots of memory but needs to run for long periods of time without reboot. E.g. tablets and smartphones.

1