Skip to content

English practice

Reading: Multiple Choice, Multiple Answers · Question 222

Automatic memory management via tracing garbage

PTE · Reading · medium

Read the text and answer the question by selecting all the correct responses. More than one response is correct.

In computer programming environments that employ managed runtimes, memory management is typically automated using a mechanism known as tracing garbage collection. Rather than requiring developers to manually allocate and release dynamic memory blocks, the runtime periodically identifies and reclaims memory that is no longer accessible to the running program. The foundational approach relies on a graph traversal algorithm starting from a base set of known references called garbage collection roots, which typically include local variables on the call stack, active execution threads, and global program references. During the initial phase, commonly termed the marking phase, the collector systematically traces through all pointers originating from these roots, flagging every reachable object in the memory heap. Once this traversal finishes, an unallocated memory sweep or compaction phase occurs, during which unflagged blocks are marked as free space or rearranged into contiguous memory regions to combat fragmentation. While this design prevents catastrophic programming bugs such as dangling pointers and memory leaks caused by forgotten deallocations, it introduces distinct computational costs. The tracing process requires processing cycles and can trigger noticeable execution pauses when the engine temporarily halts application threads, a phenomenon often referred to as stop-the-world latency.

Which of the following does the author identify as features of tracing garbage collection?

  • It forces programmers to write custom code to free every dynamically allocated block.
  • It identifies active data by traversing reference pathways starting from root pointers.
  • It eliminates the need for dynamic memory allocation entirely within modern runtimes.
  • It can cause temporary suspensions in program execution during cleanup cycles.
  • It converts unallocated memory into global variables to prevent stack overflow errors.
  • It completely prevents memory fragmentation without needing memory reorganization.