summaryrefslogtreecommitdiff
path: root/src/crash.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/crash.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/crash.zig')
-rw-r--r--src/crash.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/crash.zig b/src/crash.zig
index 34dc1b3d..a432fb87 100644
--- a/src/crash.zig
+++ b/src/crash.zig
@@ -34,6 +34,9 @@ pub const name = "crashes";
/// A panic handler is the one caller that cannot check whether its input is
/// still alive, so it does not borrow.
var dir_buf: [1024]u8 = undefined;
+
+/// The crash file's bound (see `record`).
+const max_log_bytes = 256 * 1024;
var dir_len: usize = 0;
/// Called where the launcher sets `Options.config_dir`. Ignores a path too long
@@ -109,6 +112,9 @@ pub fn record(msg: []const u8) void {
}, @as(std.c.mode_t, 0o600));
if (fd < 0) return;
defer _ = std.c.close(fd);
+ // Bounded: a file past `max_log_bytes` starts over, so it keeps the
+ // newest records rather than every crash since it was first made.
+ if (std.c.lseek(fd, 0, std.c.SEEK.END) > max_log_bytes) _ = std.c.ftruncate(fd, 0);
var w: std.Io.Writer = .fixed(&scratch);