Function realloc [src]
This function requests a new size for an existing allocation, which
can be larger, smaller, or the same size as the old memory allocation.
The result is an array of new_n items of the same type as the existing
allocation.
If new_n is 0, this is the same as free and it always succeeds.
old_mem may have length zero, which makes a new allocation.
This function only fails on out-of-memory conditions, unlike:
remap which returns null when the Allocator implementation cannot
do the realloc more efficiently than the caller
resize which returns false when the Allocator implementation cannot
change the size without relocating the allocation.
Prototype
pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) t: { const Slice = @typeInfo(@TypeOf(old_mem)).pointer; break :t Error![]align(Slice.alignment) Slice.child; }
Parameters
self: Allocator
new_n: usize
Source
pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) t: {
const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
break :t Error![]align(Slice.alignment) Slice.child;
} {
return self.reallocAdvanced(old_mem, new_n, @returnAddress());
}