GC.extend

Requests that the managed memory block referenced by p be extended in place by at least mx bytes, with a desired extension of sz bytes. If an extension of the required size is not possible or if p references memory not originally allocated by this garbage collector, no action will be taken.

struct GC
version(D_ProfileGC)
extern (C) pragma(mangle, "gc_extendTrace") static pure nothrow
size_t
extend
(
void* p
,
size_t mx
,
size_t sz
,
const TypeInfo ti = null
,
string file = __FILE__
,
int line = __LINE__
,
string func = __FUNCTION__
)

Parameters

p void*

A pointer to the root of a valid memory block or to null.

mx size_t

The minimum extension size in bytes.

sz size_t

The desired extension size in bytes.

ti TypeInfo

TypeInfo to describe the full memory block. The GC might use this information to improve scanning for pointers or to call finalizers.

Return Value

Type: size_t

The size in bytes of the extended memory block referenced by p or zero if no extension occurred.

Note: Extend may also be used to extend slices (or memory blocks with APPENDABLE info). However, use the return value only as an indicator of success. capacity should be used to retrieve actual usable slice capacity.

Meta