Files
magpie/internal
yetone ccc96b4a73 sessions: Codex's identities, rollout listings and folder listings go with the idle parses
When nobody has read the session parses for three minutes they are let
go (v0.1.3540), but the end heap of a real history still held ~10 MB made
from them or from the folders, kept for the life of the process:

- Codex's thread identities (codexIdentityMemo, ~3.5 MB);
- each Codex day folder's rollouts as last listed (rolloutsSeen, ~1.5 MB);
- every folder's listing given back to dirent (~4 MB of names and
  entries).

dropIdleCache now lets them go too, and dirent.Forget empties the kept
listings. Each is made again on the next read, from the parses and the
folders, with no session file parsed. CC's per-file UUIDs (ccUUIDMemo)
stay: letting them go would read every Claude Code file again.

Run:
- mote (macOS): go test ./internal/sessions ./internal/dirent
  ./internal/gui ./internal/usage ok; GOOS=linux and windows go vet ok.
- Broken by hand (the three drops and Forget's body removed): red, "idle:
  1 Codex identity lists and 2 folders' rollouts kept" and "9 kept after
  Forget". On Linux dirent.Stats lists nothing, so the test asks for
  rollouts kept before the drop only on macOS.
- Real accounts (a copy of the owner's history on mote, 300 s each, the
  web app opened cold, order t53 t54 t54 t53): idle footprint 117 / 120 MB
  before, 103 / 85 MB after; end heap 53.3 / 50.9 MB before, 43.4 /
  44.6 MB after. Peak unchanged (it is the start).

Not tried: Windows and Linux at runtime (the change is the same code).
2026-11-10 18:52:36 +08:00
..
…
…
…
…
…
…
…