Add thread safety checks to MimallocArena (#21806)

Make sure allocations happen on the same thread.

(For internal tracking: fixes STAB-919)
This commit is contained in:
taylor.fish
2025-08-12 22:25:04 -07:00
committed by GitHub
parent d9742eece7
commit 8d40ee17ed
3 changed files with 75 additions and 41 deletions

View File

@@ -23,7 +23,6 @@ fn mimalloc_free(
}
const MimallocAllocator = struct {
pub const supports_posix_memalign = true;
fn alignedAlloc(len: usize, alignment: mem.Alignment) ?[*]u8 {
if (comptime Environment.enable_logs)
log("mi_alloc({d}, {d})", .{ len, alignment.toByteUnits() });
@@ -77,8 +76,6 @@ const c_allocator_vtable = &Allocator.VTable{
};
const ZAllocator = struct {
pub const supports_posix_memalign = true;
fn alignedAlloc(len: usize, alignment: mem.Alignment) ?[*]u8 {
log("ZAllocator.alignedAlloc: {d}\n", .{len});