diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-23 17:10:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-23 17:10:58 -0300 |
| commit | 0073d05329335dbb0eb85f5c3044e42805d144e5 (patch) | |
| tree | 744edfc317719b2018b1c3a8657c223aec058d47 /src/main.zig | |
| parent | a8b457a306a4442975210bcac3f04b56513c61c3 (diff) | |
| download | pardes-0073d05329335dbb0eb85f5c3044e42805d144e5.tar.gz pardes-0073d05329335dbb0eb85f5c3044e42805d144e5.zip | |
Callstack lists every caller and pages a tree too big for one query; memory bounds and resident-size fixes
Callstack walks while the server answers, counts on the message row past a
second, puts test callers last at each level, and ends a tree past one
query's memory (memory.limits.arena.lsp_query, a 256 MiB region taken and
given back per query) in a row whose Callstack shows the next page. Grep
reads whole files. New hard limits: undo text per file, image decode
pixels, the LSP snapshot of other open files, one paste. Safe builds no
longer fill worst-case buffers with 0xAA (memory.unfilled), big regions are
kept off transparent huge pages, and malloc_trim runs after big results.
Also: Look's git show pages into a +Diff, and dropped marks in File.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig index 64614daa..ea2db917 100644 --- a/src/main.zig +++ b/src/main.zig @@ -16,7 +16,11 @@ pub const std_options_debug_io: std.Io = if (is_emscripten) else std_options_debug_threaded_io.?.io(); -pub const std_options: std.Options = .{ .logFn = logFn }; +// Every thread's alternate signal stack is a threadlocal that libc zeroes as +// the thread starts, so std's 256 KiB made each 9P connection's thread cost +// that much resident. A stack-overflow segfault on a thread still printed its +// whole symbolized trace from 32 KiB up (16 KiB double-faulted): 64 KiB. +pub const std_options: std.Options = .{ .logFn = logFn, .signal_stack_size = 64 * 1024 }; fn logFn( comptime level: std.log.Level, @@ -328,7 +332,11 @@ fn webMain() !void { // 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. -fn nativeMain(init: std.process.Init) !void { +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; var stderr_probe: [64]u8 = undefined; _ = std.debug.lockStderr(&stderr_probe); std.debug.unlockStderr(); |
