aboutsummaryrefslogtreecommitdiff
path: root/lib/std/heap.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-08-07 23:26:58 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-08-07 23:26:58 -0700
commit0347df82e8c821906ef0d07ec65fe4b3884c0212 (patch)
tree20076f52a0024e2252eac24683e39d3ee25d4d28 /lib/std/heap.zig
parentcc17f84cccc540143f3fd19fe32218478d4a0c6f (diff)
downloadzig-0347df82e8c821906ef0d07ec65fe4b3884c0212.tar.gz
zig-0347df82e8c821906ef0d07ec65fe4b3884c0212.zip
improvements & fixes for general purpose allocator integration
* std.Mutex API is improved to not have init() deinit(). This API is designed to support static initialization and does not require any resource cleanup. This also happens to work around some kind of stage1 behavior that wasn't letting the new allocator mutex code get compiled. * the general purpose allocator now returns a bool from deinit() which tells if there were any leaks. This value is used by the test runner to fail the tests if there are any. * self-hosted compiler is updated to use the general purpose allocator when not linking against libc.
Diffstat (limited to 'lib/std/heap.zig')
-rw-r--r--lib/std/heap.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/std/heap.zig b/lib/std/heap.zig
index 30ffa57eed..2e881dff94 100644
--- a/lib/std/heap.zig
+++ b/lib/std/heap.zig
@@ -464,7 +464,13 @@ pub const HeapAllocator = switch (builtin.os.tag) {
return buf;
}
- fn resize(allocator: *Allocator, buf: []u8, new_size: usize, len_align: u29) error{OutOfMemory}!usize {
+ fn resize(
+ allocator: *Allocator,
+ buf: []u8,
+ buf_align: u29,
+ new_size: usize,
+ len_align: u29,
+ ) error{OutOfMemory}!usize {
const self = @fieldParentPtr(HeapAllocator, "allocator", allocator);
if (new_size == 0) {
os.windows.HeapFree(self.heap_handle.?, 0, @intToPtr(*c_void, getRecordPtr(buf).*));