View source code
Display the source code in core/memory.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.
Function core.memory.GC.malloc
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.
Parameters
Name | Description |
---|---|
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
A reference to the allocated memory or null if insufficient memory is available.
Throws
OutOfMemoryError on allocation failure.
Authors
Sean Kelly, Alex Rønne Petersen
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.