diff options
| author | 2022-03-14 05:39:22 -0700 | |
|---|---|---|
| committer | 2022-03-14 05:39:22 -0700 | |
| commit | 13f1cdca7bdac4b06b4d521e3ea2b371663387ff (patch) | |
| tree | e3ed18751cdc481ddc71947193f62cfcd3860c65 /src/memory_allocator.zig | |
| parent | 00977c75ba090587140f3e110c51e30016c8efb3 (diff) | |
| download | bun-13f1cdca7bdac4b06b4d521e3ea2b371663387ff.tar.gz bun-13f1cdca7bdac4b06b4d521e3ea2b371663387ff.tar.zst bun-13f1cdca7bdac4b06b4d521e3ea2b371663387ff.zip | |
add another assertion
Diffstat (limited to '')
| -rw-r--r-- | src/memory_allocator.zig | 9 |
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); + } } }; |
