Memory management. The code in this module is borrowed from David Simcha's
specifically the dstats.alloc module.
|Appends to an array, deleting the old array if it has to be realloced.
|Lengthens an array w/o initializing new elements.
|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.
|Returns a new array of type T w/o initializing elements.
|Reserves more space for an array w/o changing its length or initializing
|**Same as newStack(size_t) but uses stateCopy cached on stack by caller
|Creates a duplicate of a range for temporary use within a function in the
best wsy that can be done safely. If ElementType!(T) is a value type
or T is an array, the results can safely be placed in TempAlloc because
either it doesn't need to be scanned by the GC or there's guaranteed to be
another reference to the contents somewhere. Otherwise, the results
are placed on the GC heap.
|Converts any range to an array on the GC heap by the most efficient means
available. If it is already an array, duplicates the range.
|A struct to allocate memory in a strictly first-in last-out order for
things like scratch space. Technically, memory can safely escape the
scope in which it was allocated. However, this is a very bad idea
unless being done within the private API of a class, struct or nested
function, where it can be guaranteed that LIFO will not be violated.
|A string to mixin at the beginning of a scope, purely for
convenience. Initializes a TempAlloc frame using frameInit(),
and inserts a scope statement to delete this frame at the end
of the current scope.