Function Mallocator.reallocate
Increases or decreases the size of a memory block.
bool reallocate
(
ref void[] p,
ulong size
);
Parameters
Name | Description |
---|---|
p | A pointer to the memory block. |
size | Size of the reallocated block. |
Returns
Whether the reallocation was successful.
Example
void[] p;
Mallocator .instance .reallocate(p, 20);
assert(p .length == 20);
Mallocator .instance .reallocate(p, 30);
assert(p .length == 30);
Mallocator .instance .reallocate(p, 10);
assert(p .length == 10);
Mallocator .instance .reallocate(p, 0);
assert(p is null);