GC.reserveArrayCapacity

size_t reserveArrayCapacity(void[] slice, size_t request, bool atomic = false) nothrow @safe

Expand the array capacity in place.

Used for reserving space that can be used for appending. If the operation can be performed without reallocating, the function succeeds. The used size is not changed. Slices that do not point at expandable GC blocks cannot be affected, and this function will always return zero.

Parameters

slicethe slice to attempt reserving capacity for.
requestthe requested size to expand to. Includes the existing data. Passing a value less than the current array size will result in no changes, but will return the current capacity.
atomicThe array may be shared between threads, and this operation should be done atomically.

Returns

Resulting capacity size or 0 if the operation could not be performed.