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.

Enum core.memory.GC.BlkAttr

Elements for a bit field representing memory block attributes. These are manipulated via the getAttr, setAttr, clrAttr functions.

enum BlkAttr : uint { ... }

Enum members

NameDescription
APPENDABLE This block contains the info to allow appending.

This can be used to manually allocate arrays. Initial slice size is 0.

Note

The slice's usable size will not match the block size. Use capacity to retrieve actual usable capacity.

Example

// Allocate the underlying array.
int*  pToArray = cast(int*)GC.malloc(10 * int.sizeof, GC.BlkAttr.NO_SCAN | GC.BlkAttr.APPENDABLE);
// Bind a slice. Check the slice has capacity information.
int[] slice = pToArray[0 .. 0];
assert(capacity(slice) > 0);
// Appending to the slice will not relocate it.
slice.length = 5;
slice ~= 1;
assert(slice.ptr == p);
FINALIZE Finalize the data in this block on collect.
NO_INTERIOR This block is guaranteed to have a pointer to its base while it is alive. Interior pointers can be safely ignored. This attribute is useful for eliminating false pointers in very large data structures and is only implemented for data structures at least a page in size.
NO_MOVE Do not move this memory block on collect.
NO_SCAN Do not scan through this block on collect.
NONE No attributes set.

Authors

Sean Kelly, Alex Rønne Petersen

License

Boost License 1.0