Files
bun.sh/src/allocators/fallback.zig
taylor.fish 0c83ff3f7e Fix z_allocator implementation when use_mimalloc is false; make Bun compile with use_mimalloc false (#21771)
We can't use `std.heap.c_allocator` as `z_allocator`; it doesn't
zero-initialize the memory. This PR adds a fallback implementation.

This PR also makes Bun compile successfully with `use_mimalloc` set to
false. More work is likely necessary to make it function correctly in
this case, but it should at least compile.

(For internal tracking: fixes STAB-978, STAB-979)
2025-08-11 20:20:58 -07:00

10 lines
272 B
Zig

pub const c_allocator = std.heap.c_allocator;
pub const z_allocator = @import("./fallback/z.zig").allocator;
/// libc can free allocations without being given their size.
pub fn freeWithoutSize(ptr: ?*anyopaque) void {
std.c.free(ptr);
}
const std = @import("std");