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. * * 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.
Returns a new array of type T w/o initializing elements.
Reserves more space for an array w/o changing its length or initializing * the space.
Concatenate any number of arrays of the same type, placing results on * the TempAlloc stack.
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. * * Slower than calling free() manually when only a few pieces * of memory will be allocated in the current scope, due to the * extra bookkeeping involved. Can be faster, however, when * large amounts of allocations, such as arrays of arrays, * are allocated, due to caching of data stored in thread-local * storage.
Memory management. The code in this module is borrowed from David Simcha's dstats project, specifically the dstats.alloc module.