rt.lifetime

This module contains all functions related to an object's lifetime: allocation, resizing, deallocation, and finalization.

Members

Functions

__arrayAlloc
BlkInfo __arrayAlloc(size_t arrsize, const TypeInfo ti, const TypeInfo tinext)

allocate an array memory block by applying the proper padding and assigning block attributes if not inherited from the existing block

__arrayAllocLength
size_t __arrayAllocLength(ref BlkInfo info, const TypeInfo tinext)

get the allocation size of the array for the given block (without padding or type info)

__arrayPad
size_t __arrayPad(size_t size, const TypeInfo tinext)

get the padding required to allocate size bytes. Note that the padding is NOT included in the passed in size. Therefore, do NOT call this function with the size of an allocated block.

__arrayStart
void* __arrayStart(BlkInfo info)

get the start of the array for the given block

__getBlkInfo
BlkInfo* __getBlkInfo(void* interior)

Get the cached block info of an interior pointer. Returns null if the interior pointer's block is not cached.

__setArrayAllocLength
bool __setArrayAllocLength(ref BlkInfo info, size_t newlength, bool isshared, const TypeInfo tinext, size_t oldlength = ~0)

Set the allocated length of the array block. This is called any time an array is appended to or its length is set.

_d_allocmemory
void* _d_allocmemory(size_t sz)
_d_arrayappendT
void[] _d_arrayappendT(const TypeInfo ti, ref byte[] x, byte[] y)

Append y[] to array x[]

_d_arrayappendcTX
byte[] _d_arrayappendcTX(const TypeInfo ti, ref byte[] px, size_t n)

Extend an array by n elements. Caller must initialize those elements.

_d_arrayappendcd
void[] _d_arrayappendcd(ref byte[] x, dchar c)

Append dchar to char[]

_d_arrayappendwd
void[] _d_arrayappendwd(ref byte[] x, dchar c)

Append dchar to wchar[]

_d_arraycatT
byte[] _d_arraycatT(const TypeInfo ti, byte[] x, byte[] y)
_d_arraycatnTX
void[] _d_arraycatnTX(const TypeInfo ti, byte[][] arrs)
_d_arrayliteralTX
void* _d_arrayliteralTX(const TypeInfo ti, size_t length)

Allocate the array, rely on the caller to do the initialization of the array.

_d_arraysetcapacity
size_t _d_arraysetcapacity(const TypeInfo ti, size_t newcapacity, void[]* p)

set the array capacity. If the array capacity isn't currently large enough to hold the requested capacity (in number of elements), then the array is resized/reallocated to the appropriate size. Pass in a requested capacity of 0 to get the current capacity. Returns the number of elements that can actually be stored once the resizing is done.

_d_arraysetlengthT
void[] _d_arraysetlengthT(const TypeInfo ti, size_t newlength, void[]* p)

Resize dynamic arrays with 0 initializers.

_d_arraysetlengthiT
void[] _d_arraysetlengthiT(const TypeInfo ti, size_t newlength, void[]* p)

Resize arrays for non-zero initializers. p pointer to array lvalue to be updated newlength new .length property of array sizeelem size of each element of array initsize size of initializer ... initializer

_d_arrayshrinkfit
void _d_arrayshrinkfit(const TypeInfo ti, void[] arr)

Shrink the "allocated" length of an array to be the exact size of the array. It doesn't matter what the current allocated length of the array is, the user is telling the runtime that he knows what he is doing.

_d_callfinalizer
void _d_callfinalizer(void* p)
_d_callinterfacefinalizer
void _d_callinterfacefinalizer(void* p)
_d_delarray_t
void _d_delarray_t(void[]* p, const TypeInfo_Struct ti)
_d_delclass
void _d_delclass(Object* p)
_d_delinterface
void _d_delinterface(void** p)
_d_delmemory
void _d_delmemory(void** p)
_d_delstruct
void _d_delstruct(void** p, TypeInfo_Struct inf)

This is called for a delete statement where the value being deleted is a pointer to a struct with a destructor but doesn't have an overloaded delete operator.

_d_newarrayOpT
void[] _d_newarrayOpT(const TypeInfo ti, size_t[] dims)
_d_newarrayT
void[] _d_newarrayT(const TypeInfo ti, size_t length)

Allocate a new array of length elements. ti is the type of the resulting array, or pointer to element. (For when the array is initialized to 0)

_d_newarrayU
void[] _d_newarrayU(const TypeInfo ti, size_t length)

Allocate a new uninitialized array of length elements. ti is the type of the resulting array, or pointer to element.

_d_newarrayiT
void[] _d_newarrayiT(const TypeInfo ti, size_t length)

For when the array has a non-zero initializer.

_d_newarraymTX
void[] _d_newarraymTX(const TypeInfo ti, size_t[] dims)
_d_newarraymiTX
void[] _d_newarraymiTX(const TypeInfo ti, size_t[] dims)
_d_newclass
Object _d_newclass(const ClassInfo ci)
_d_newitemT
void* _d_newitemT(in TypeInfo _ti)

Same as above, zero initializes the item.

_d_newitemU
void* _d_newitemU(in TypeInfo _ti)

Allocate an uninitialized non-array item. This is an optimization to avoid things needed for arrays like the __arrayPad(size).

_d_newitemiT
void* _d_newitemiT(in TypeInfo _ti)

Same as above, for item with non-zero initializer.

newCapacity
size_t newCapacity(size_t newlength, size_t size)
rt_finalize2
void rt_finalize2(void* p, bool det = true, bool resetMemory = true)
rt_getCollectHandler
CollectHandler rt_getCollectHandler()
rt_hasFinalizerInSegment
int rt_hasFinalizerInSegment(void* p, size_t size, uint attr, in void[] segment)
rt_setCollectHandler
void rt_setCollectHandler(CollectHandler h)

Manifest constants

N_CACHE_BLOCKS
enum N_CACHE_BLOCKS;

cache for the lookup of the block info

Structs

Array
struct Array

Meta

License

Distributed under the Boost Software License 1.0. (See accompanying file LICENSE)

Authors

Walter Bright, Sean Kelly, Steven Schveighoffer

Suggestion Box / Bug Report