Memo Language Logo

About GC Explorer

Automatic memory management (garbage collection) can be complicated. GC Explorer lets you watch the behavior of various GC algorithms live in the browser.

How it Works

To use GC explorer you write programs in a tiny garbage-collected language called Memo. You can step through the execution of the program and visualize the memory layout as the program runs, including the garbage collector.

The basic idea is that you edit the program on the left and then use the (run/previous/next) controls to observe its behavior:

You can modify any not-yet-executed instruction and run it, as well as back up to before an instruction, modify it and re-run. Modifying instructions in the past has no impact unless you also back up.

Implemented GC Algorithms

GC explorer currently supports the following algorithms:

All of these except reference counting—which operated immediately—operate in a stop-the-world mode, where the GC runs to completion. In the future we may add a concurrent mode, but these are harder to implement and demonstrate. Adding multiple generations (generation scavenging) is on the TODO list.

Changing the GC requires restarting the program from scratch, because different GCs use different memory layouts.

Triggering the GC

You can invoke the garbage collector using a special pseudoinstruction (#gc). See here.