szn

Bug 461 — cmdJoinPane placeholder pane never deinited (arena bloat)

461. Placeholder leaf orphaned in the session arena

Severity: MEDIUM Status: ✅ FIXED Files: src/cmd/cmd.zig


Root Cause Analysis

In src/cmd/cmd.zig:425-444:

const placeholder: ?*Pane = if (...) blk: {
    const a = session.arenaAllocator();
    const dummy = a.create(Pane) catch { ... };
    dummy.* = Pane.init(a, 9999, 1, 1) catch { ... };
    break :blk dummy;
} else null;
...
src_win.layout.root.leaf = dummy;
session.killWindow(server.allocator, src_win); // only deinits win.panes.items

placeholder is never in src_win.panes, never deinitd. With gpa this would be a hard leak; with the session arena it is retained bloat per join-pane-that-empties-source.

Proposed Fix

Avoid the dummy allocation (teach killWindow to handle an empty layout root), or explicitly dummy.deinit() after teardown when the layout no longer references it. Add a test asserting arena usage does not grow across repeated join/extract cycles.