diff options
author | 2022-03-02 21:13:34 -0800 | |
---|---|---|
committer | 2022-03-02 21:13:34 -0800 | |
commit | 1a027825392ae64aade576b7ff4338ca35e8dded (patch) | |
tree | ac3aa15f2835829b1a69e4cb172f59ab6c84e758 /src/mimalloc_arena.zig | |
parent | c7941bfab03b83cedf29bd6536bdd8f5e82d9ec9 (diff) | |
download | bun-1a027825392ae64aade576b7ff4338ca35e8dded.tar.gz bun-1a027825392ae64aade576b7ff4338ca35e8dded.tar.zst bun-1a027825392ae64aade576b7ff4338ca35e8dded.zip |
[internal] log memory allocations in mimalloc arenas
Diffstat (limited to 'src/mimalloc_arena.zig')
-rw-r--r-- | src/mimalloc_arena.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mimalloc_arena.zig b/src/mimalloc_arena.zig index e2f7aac60..21eae175b 100644 --- a/src/mimalloc_arena.zig +++ b/src/mimalloc_arena.zig @@ -4,6 +4,7 @@ const std = @import("std"); const mimalloc = @import("./allocators/mimalloc.zig"); const Environment = @import("./env.zig"); +const FeatureFlags = @import("./feature_flags.zig"); const Allocator = mem.Allocator; const assert = std.debug.assert; @@ -46,6 +47,8 @@ pub const Arena = struct { } fn alignedAlloc(heap: *mimalloc.mi_heap_t, len: usize, alignment: usize) ?[*]u8 { + if (comptime FeatureFlags.log_allocations) std.debug.print("Malloc: {d}\n", .{len}); + // this is the logic that posix_memalign does var ptr = if (mi_malloc_satisfies_alignment(alignment, len)) mimalloc.mi_heap_malloc(heap, len) |