summaryrefslogtreecommitdiff
path: root/src/macos.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-23 17:10:58 -0300
committerGabriel Schneider <[email protected]>2026-10-23 17:10:58 -0300
commit0073d05329335dbb0eb85f5c3044e42805d144e5 (patch)
tree744edfc317719b2018b1c3a8657c223aec058d47 /src/macos.zig
parenta8b457a306a4442975210bcac3f04b56513c61c3 (diff)
downloadpardes-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/macos.zig')
-rw-r--r--src/macos.zig17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/macos.zig b/src/macos.zig
index 50fa04fa..5d3dfec4 100644
--- a/src/macos.zig
+++ b/src/macos.zig
@@ -44,7 +44,11 @@ fn hostWatchFile(pane: u8, generation: u32, path: ?[*]const u8, path_len: usize)
const TIOCSWINSZ: c_int = @bitCast(@as(u32, if (@hasDecl(posix.T, "IOCSWINSZ")) posix.T.IOCSWINSZ else 0x80087467));
-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,
@@ -2419,7 +2423,7 @@ fn pipeWorker(st: *State, job: *selection_pipe.Job) anyerror!void {
}
fn lspWorker(st: *State, job: *host_io.Lsp.Job) anyerror!void {
- host_io.Lsp.work(st.gpa, job, st, deliverLspRows);
+ host_io.Lsp.work(st.io, st.gpa, job, st, deliverLspRows);
}
fn deliverLspRows(ctx: ?*anyopaque, id: u32, rows: ?[]u8) void {
@@ -2582,12 +2586,11 @@ fn reap(st: *State, pane: u8) void {
}
fn readPty(st: *State, io: std.Io, pty: std.Io.File, id: u8, gen: u32) anyerror!void {
- var read_buf: [0x10000]u8 = undefined;
- var reader = pty.readerStreaming(io, &read_buf);
+ // One buffer, read into directly: a Reader around it only added a second
+ // (and in a safe build, filled both as `undefined` on every start).
+ var buf: [0x10000]u8 = undefined;
while (true) {
- var buf: [0x10000]u8 = undefined;
- var vec = [_][]u8{&buf};
- const n = reader.interface.readVec(&vec) catch break;
+ const n = pty.readStreaming(io, &.{&buf}) catch break;
if (n == 0) break;
const bytes = st.gpa.dupe(u8, buf[0..n]) catch break;
st.inbox.pushOutput(st.gpa, io, .{ .pane = id, .gen = gen, .bytes = bytes }) catch break;