System Design · Interactive workshop
The memory lifetime workbench
Build it. Run it. Follow the bytes.
Memory demand depends on which allocations are live at the same time. Step through calls, allocations and releases to inspect peak heap use, reusable space and allocation failures. Repair four guided schedules: budget for the answer, release an unnecessary copy, keep a returned result alive and join fragmented free space.
The canvas runs in your browser and needs JavaScript. You can read the model below and read the accompanying Library lesson without JavaScript.
What this machine models
Model memory-lifetimes-1 uses separate conceptual stack and heap ranges, each 1 to 256 bytes. Enter reserves a stack frame; leave releases the top frame. Heap allocation uses first fit and requires a contiguous hole. Free makes that space reusable. Returning from a frame does not release its heap allocations.
Programs contain 1 to 40 operations and at most 2400 characters. Names are unique throughout a run. Reads check lifetime and offsets without modeling byte contents. Invalid syntax refuses execution. Capacity failures, repeated release and invalid access stop as incomplete with the last valid state intact.
This is an explicit allocation teaching model, not a C interpreter or garbage collector. No allocator headers, alignment, address translation, physical RAM residency, OS memory return or program output is modeled. The allocation schedules alone cannot prove equivalent computation.
Step, Back and playback reveal recorded states. One pinned comparison retains its inputs. Guests and members share the same temporary browser-memory behavior through article detours. Reload clears the session; no grade or assessment is saved.
By GOAT Engineer. Explore System Design · Privacy Policy · Contact.