Frequently asked questions

What HeapHop runs, where your code goes, and what the pictures mean. Click a question to open it.

What is HeapHop?
A tool that runs a C++ program one statement at a time and draws what happens in memory: the stack frames, every object created with new, and every pointer between them. It is made for the linked-list and tree programs of a first data-structures course.
Should I start with Learn or with the Editor?
If the topic is new to you, start with Learn: the lessons pause at the important moments and ask you questions. If you already have a program, such as a lab task, open the Editor, paste it and press Run.
Do I need to install anything or make an account?
Nothing to install: HeapHop runs in the browser, on a computer or a phone. Learn and the Editor need a free account, which keeps only your name, email and university. See the privacy policy.
Is my code sent to a server?
No. Your program is run inside your own browser, in a background thread of the page. It is never uploaded. See the privacy policy.
Can it run any C++ program?
No. HeapHop does not compile C++; it runs a part of the language that covers structs, classes, pointers, new and delete, arrays, functions, loops, recursion and cin. Templates, the STL (vector, list, stack, queue) and inheritance are not supported. The full list is on What C++ is supported.
My program stopped with “is not supported yet”. What now?
The message names the line HeapHop could not run. Rewrite that line with the constructs on the supported list, for example a pointer and new instead of a vector. HeapHop stops rather than guess, so a picture is never drawn from code it did not understand.
Does it print the same output as a real compiler?
For supported programs, yes. The test programs, including real lab programs, print exactly what g++ prints. The one difference is on purpose: where real C++ would crash or behave unpredictably (a null pointer, a use after delete), HeapHop stops at that line and explains what went wrong.
My program reads input with cin. How do I give it input?
When the code contains cin, a Program input box appears under the editor. Type everything the program will read before you press Run, in order, separated by spaces or new lines. If the input runs out, HeapHop stops and tells you which line was waiting.
What happens with an infinite loop?
The run stops after 2000 steps, 500 rounds of one loop or 64 nested calls, and every step before that stays visible, so you can see where the loop went wrong.
Who is Byte, the little robot?
Byte is HeapHop's robot helper. When you step one line at a time, Byte acts out what that line did: it drags a pointer's arrow to its new node, brings a node created with new into place, carries a deleted node away, and follows pointers like cur from node to node. In trees it flies on rocket boots and returns to its corner after each move. During auto-play, or when you jump on the timeline, it waits in its corner. The robot button in the canvas toolbar switches Byte off, and it starts off on devices set to reduce motion.
What do the colours and dashed boxes mean?
A node with a red dashed border can no longer be reached from any pointer: it has leaked. A pointer marked dangling still holds the address of an object that was deleted. Teal arrows are next pointers and amber arrows are prev pointers; in a tree, the branches join each node to its children. The small labels above a node show which variables point at it.
Where are my programs saved?
In your browser's local storage on this device. They stay after you close the tab, but they are not copied to other devices, and clearing the site's data in your browser removes them.
Who made HeapHop?
A team of Cyber Security students at Air University. See About.