View source code
Display the source code in rt/lifetime.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Module rt.lifetime

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

Functions

NameDescription
newCapacity(newlength, size)
rt_finalize2(p, det, resetMemory)
rt_getCollectHandler()
rt_hasFinalizerInSegment(p, size, attr, segment)
rt_setCollectHandler(h)
_d_allocmemory(sz)
_d_arrayappendcd(x, c) Append dchar to char[]
_d_arrayappendcTX(ti, px, n) Extend an array by n elements. Caller must initialize those elements.
_d_arrayappendT(ti, x, y) Append y[] to array x[]
_d_arrayappendwd(x, c) Append dchar to wchar[]
_d_arraycatnTX(ti, arrs)
_d_arraycatT(ti, x, y)
_d_arrayliteralTX(ti, length) Allocate the array, rely on the caller to do the initialization of the array.
_d_arraysetcapacity(ti, newcapacity, 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_arraysetlengthiT(ti, newlength, 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_arraysetlengthT(ti, newlength, p) Resize dynamic arrays with 0 initializers.
_d_arrayshrinkfit(ti, 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(p)
_d_callinterfacefinalizer(p)
_d_delarray(p) This function has been replaced by d_delarray_t
_d_delarray_t(p, ti)
_d_delclass(p)
_d_delinterface(p)
_d_delmemory(p)
_d_delstruct(p, 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_newarrayiT(ti, length) For when the array has a non-zero initializer.
_d_newarraymiTX(ti, dims)
_d_newarraymTX(ti, dims)
_d_newarrayOpT(ti, dims)
_d_newarrayT(ti, 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(ti, length) Allocate a new uninitialized array of length elements. ti is the type of the resulting array, or pointer to element.
_d_newclass(ci)
_d_newitemiT(_ti) Same as above, for item with non-zero initializer.
_d_newitemT(_ti) Same as above, zero initializes the item.
_d_newitemU(_ti) Allocate an uninitialized non-array item. This is an optimization to avoid things needed for arrays like the _arrayPad(size).

Structs

NameDescription
Array

Manifest constants

NameTypeDescription
N_CACHE_BLOCKS cache for the lookup of the block info

Authors

Walter Bright, Sean Kelly, Steven Schveighoffer

License

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