View source code Display the source code in core/memory.d from which this page was generated on github. 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. Page wiki View or edit the community-maintained wiki page associated with this page.

Function core.memory.GC.qalloc

Requests an aligned block of managed memory from the garbage collector. This memory may be deleted at will with a call to free, or it may be discarded and cleaned up automatically during a collection run. If allocation fails, this function will call onOutOfMemory which is expected to throw an OutOfMemoryError.

Prototype

static core.memory.BlkInfo_ qalloc(
  ulong sz,
  uint ba = 0u,
  const(TypeInfo) ti = null
) pure nothrow;

Parameters

NameDescription
sz The desired allocation size in bytes.
ba A bitmask of the attributes to set on this block.
ti TypeInfo to describe the memory. The GC might use this information to improve scanning for pointers or to call finalizers.

Returns

Information regarding the allocated memory block or BlkInfo.init on error.

Throws

OutOfMemoryError on allocation failure.

Authors

Sean Kelly, Alex Rønne Petersen

License

Boost License 1.0

Comments