Stuff having to do with memory management. Mostly a copy of RegionAllocator for now until it gets into Phobos, as well as some RegionAllocator-specific data structures.
The exception that is thrown on invalid use of $(RegionAllocator) and RegionAllocatorStack. This exception is not thrown on out of memory. An OutOfMemoryError is thrown instead.
This flag determines whether a given RegionAllocatorStack is scanned for pointers by the garbage collector (GC). If yes, the entire stack is scanned, not just the part currently in use, since there is currently no efficient way to modify the bounds of a GC region. The stack is scanned conservatively, meaning that any bit pattern that would point to GC-allocated memory if interpreted as a pointer is considered to be a pointer. This can result in GC-allocated memory being retained when it should be freed. Due to these caveats, it is recommended that any stack scanned by the GC be small and/or short-lived.
Appends to an array, deleting the old array if it has to be realloced.
These properties determine whether the default thread-local RegionAllocatorStack instance is scanned by the garbage collector. The default is no. In most cases, scanning a stack this long-lived is not recommended, as it will cause too many false pointers. (See std.regionallocator.GCScan for details.)
These properties get and set the segment size of the default thread-local RegionAllocatorStack instance. The default size is 4 megabytes. The setter is only effective before the global function newRegionAllocator has been called for the first time in the current thread. Attempts to set this property after the first call to this function from the current thread throw a RegionAllocatorException.
Forward range struct for iterating over the keys or values of a StackHash or StackSet. The lifetime of this object must not exceed that of the underlying StackHash or StackSet.
This struct provides an interface to the RegionAllocator functionality and enforces scoped deletion. A new instance using the thread-local RegionAllocatorStack instance is created using the global newRegionAllocator function. A new instance using an explicitly created RegionAllocatorStack is created using RegionAllocatorStack.newRegionAllocator.
A hash table that allocates its memory on RegionAllocator. Good for building a temporary hash tables that will not escape the current scope.
A hash set that allocates its memory on RegionAllocator. Good for building a temporary set that will not escape the current scope.
An AVL tree implementation on top of RegionAllocator. If elements are removed, they are stored on an internal free list and recycled when new elements are added to the tree.
An associative array implementation based on StackTree. Lookups and insertions are O(log N). This is significantly slower in both theory and practice than StackHash, but you may want to use it if:
Struct that iterates over keys or values of a StackTreeAA.