I'm reverse-engineering an older game that was probably written in C or C++. I found a function that, when it fails, loads a pointer to one of several messages such as "Could not create main heap!!n", "Could not create menu heap!!n", "Could not create level heap!!n", or "Could not create level connector heap!!n".
I've started mapping the memory structures and locating other functions that reference them, but I'm still unclear about what these structures represent. When I searched for information about heaps, I mostly found explanations of the heap data structure—a tree-like structure commonly represented with an array. The structure in this game appears more complicated than those examples.
In this context, is "heap" referring to dynamically allocated memory rather than the tree-based data structure? Could these be separate memory pools or arena allocators for different parts of the game?
3 Answers
There are two unrelated meanings of “heap.” A heap data structure is the tree-like priority-queue structure you found in textbooks. In an error such as “could not create level heap,” the game almost certainly means a runtime memory heap: an area or allocator used to obtain memory dynamically while the program is running.
The names suggest the game may maintain separate pools for systems such as the main program, menus, levels, and level transitions. Those could be custom arenas or sub-heaps rather than four completely independent operating-system heaps.
The internal representation of a memory heap is not standardized. An allocator might use free lists, linked blocks, pages, bitmaps, an arena, or several of these together. A reverse-engineered structure that looks more complicated than an array-based tree is therefore completely normal.
The labels in the error strings are a useful clue, but you’ll need to inspect how the structure is initialized and how allocation and release functions use it. Look for fields containing a base address, total size, current position, free-block information, alignment values, or linked-list pointers. That should help distinguish an arena allocator from a general-purpose heap manager.
A memory heap is generally used for data whose size or lifetime is determined at runtime. In C, calls such as malloc obtain memory from an allocator; in C++, new commonly does the same. The stack is typically used for function calls, parameters, and local variables, while dynamically allocated objects are stored in heap-managed memory and accessed through pointers.
If creating one of these heaps fails, the game may be unable to reserve or initialize the memory pool it needs. That could be due to insufficient memory, an invalid requested size, fragmentation, or a failure in the game’s own allocator.

That makes sense. I was treating every mention of “heap” as the data structure, but the separate names for menu and level memory probably indicate custom pools used by the engine.