Basic module

realloc

procedureSource

Resizes a block from alloc to size bytes and returns the block, which may have moved. old_size is the size it has now. The first min(size, old_size) bytes are kept.

realloc :: (memory: *void, size: s64, old_size: s64) -> *void

Parameters

memory: *void
size: s64
old_size: s64

Returns

*void
Example↗
memory := cast(*u8) alloc(4);
memory[0] = 42;
memory = cast(*u8) realloc(memory, 64, 4);
defer free(memory);
assert(memory[0] == 42);

See also