summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main.zig b/src/main.zig
index 52093b9a..9086fa90 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -317,16 +317,13 @@ fn webMain() !void {
try @import("gui/gui.zig").run(.{}, .{}, null);
}
-// init.gpa, what the tty, gui and detached shells allocate from, is
-// std.start's: a DebugAllocator in Debug and, since we link libc, libc's
-// malloc otherwise. Kept on purpose: glibc's malloc was measured at least as
-// fast as std.heap.smp_allocator on every scenario and faster on MuPDF's
-// page-sized rasters. macos.zig makes the same choice for itself.
+// init.gpa, what the tty, gui and detached shells allocate from, is their
+// own fixed arena (memory.host) in a release build, spilling to libc's
+// malloc, and std.start's DebugAllocator in Debug. Zig 0.17's std.start
+// gives a safe build a SafeAllocator over the page allocator instead.
fn nativeMain(std_init: std.process.Init) !void {
var init = std_init;
- // Zig 0.17's std.start gives a safe build a SafeAllocator over the page
- // allocator, not libc's malloc: hand the shells malloc, as above.
- if (builtin.mode != .debug) init.gpa = std.heap.c_allocator;
+ if (builtin.mode != .debug) init.gpa = pardes.memory.host(std.heap.c_allocator);
var stderr_probe: [64]u8 = undefined;
_ = std.debug.lockStderr(&stderr_probe);
std.debug.unlockStderr();