Function newStack
Allocates an array of type T and size size using TempAlloc. Note that appending to this array using the ~= operator, or enlarging it using the .length property, will result in undefined behavior. This is because, if the array is located at the beginning of a TempAlloc block, the GC will think the capacity is as large as a TempAlloc block, and will overwrite adjacent TempAlloc-allocated data, instead of reallocating it.
T[] newStack(T)
(
size_t size,
TempAlloc .State state = null
) nothrow;
Bugs
Do not store the only reference to a GC-allocated reference object in an array allocated by newStack because this memory is not scanned by the GC.