Module tanya.memory

Dynamic memory management.

Functions

NameDescription
alignedSize(size, alignment)
defaultAllocator()
defaultAllocator(allocator) Sets the default allocator.
dispose(allocator, p) Destroys and deallocates p of type T. It is assumed the respective entities had been allocated with the same allocator.
make(allocator, args) Constructs a new class instance of type T using args as the parameter list for the constructor of T.
make(allocator, args) Constructs a value object of type T using args as the parameter list for the constructor of T and returns a pointer to the new object.
make(allocator, n) Constructs a new array with n elements.

Templates

NameDescription
DefaultAllocator The mixin generates common methods for classes and structs using allocators. It provides a protected member, constructor and a read-only property, that checks if an allocator was already set and sets it to the default one, if not (useful for structs which don't have a default constructor).

Manifest constants

NameTypeDescription
stateSize Returns the size in bytes of the state that needs to be allocated to hold an object of type T.