Piles


A pile is a block of raw memory. Portions of its memory can be allocated from the beginning of the pile in constant time, and the pile can be emptied and its pointer reset to the beginning.
<pile> ( size -- pile )

pile-alloc ( pile size -- alien )

<pile-c-array> ( pile n c-type -- alien )

<pile-c-object> ( pile c-type -- alien )

pile-align ( pile align -- pile )

pile-empty ( pile -- )


An example of the utility of piles is in video games. For example, the game Abuse was scripted with a Lisp dialect. In order to avoid stalls from traditional GC or heap-based allocators, the Abuse Lisp VM would allocate values from a preallocated pile over the course of a frame, and release the entire pile at the end of the frame.