aboutsummaryrefslogtreecommitdiff
path: root/src/memory_allocator.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/memory_allocator.zig')
-rw-r--r--src/memory_allocator.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/memory_allocator.zig b/src/memory_allocator.zig
index 3b5188895..1cc6f9caf 100644
--- a/src/memory_allocator.zig
+++ b/src/memory_allocator.zig
@@ -141,7 +141,14 @@ const CAllocator = struct {
) void {
_ = buf_align;
_ = return_address;
- mimalloc.mi_free(buf.ptr);
+ // mi_free_size internally just asserts the size
+ // so it's faster if we don't pass that value through
+ // but its good to have that assertion
+ if (comptime Environment.allow_assert) {
+ mimalloc.mi_free_size(buf.ptr, buf.len);
+ } else {
+ mimalloc.mi_free(buf.ptr);
+ }
}
};