* Engine: cap glibc malloc arenas on Linux
glibc gives every thread a 64MB arena (default cap 8 × cores) and trims only
the top of a heap, so a headless engine held 6.6GB in 129 arenas (7.2GB RSS)
after a day. mallopt at startup caps arenas at 2 and sets trim/mmap thresholds
to 128KB; GLIBC_TUNABLES/MALLOC_* still win. Bench RSS after 60s idle: 226MB →
159MB (this checkout 278MB → 191MB).
* Engine: trim glibc arenas periodically instead of capping them
Capping glibc at two arenas cut idle RSS in the streaming bench but
multiplied the engine's CPU about six times (futex calls 166k -> 1.6M) as
threads queued on the shared arena locks. A periodic malloc_trim(0)
releases the free pages inside every arena, which is what was being
retained, and costs nothing while chats stream.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Wing <contact@winglee.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Wing's report — memory grows unbounded while scrolling sessions and
switching between them — is not a heap leak: transcript caches clear on
switch and heaptrack shows the churn freed (peak heap 13.5MB, 1.46MB
leaked on a workload whose RSS climbed by hundreds of MB). The ratchet
is the allocator. `mimalloc = "0.1"` drifted onto crate 0.1.52, whose
libmimalloc-sys default bundles mimalloc v3.3.2, and v3 retains the
streaming/render churn as permanent RSS instead of returning it: a
daemon serving six streamed chats reached 908MB against 7.3MB of docs
on disk and never recovered at idle, while a glibc control stayed flat
on identical workloads. Purge knobs (MIMALLOC_PURGE_DELAY=0,
MIMALLOC_ABANDONED_PAGE_PURGE=1) do not rescue v3.
Fix: select the crate's `v2` feature (mimalloc 2.3.2, roughly half of
v3's retention) and register the allocator only on macOS — the
libmalloc watermark it was adopted for (docs/memory-plan.md §1). Linux
returns to glibc, which measured flat on every scenario (streaming
daemon, session switching, 2min of continuous scrolling).
Full workspace suite: 1206 passed, 1 pre-existing load-timeout flake
(interrupt_unblocks_a_run_awaiting_input, passes 3/3 in isolation).
Co-authored-by: wing-anara <wing@anara.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
- binary/CLI `comet` -> `zeron`; crates comet-* -> zeron-*; COMET_* -> ZERON_*
- data dir ~/.comet-native -> ~/.zeron, with a one-shot rename migration
- services: comet-native.service -> zeron.service; launchd sh.zeron.comet ->
sh.zeron.app; macOS bundle id dev.comet.native -> sh.zeron.app
- release artifacts comet-<ver>-* -> zeron-<ver>-*; drop the Comet.app
tarball-path compat hack in package-macos.sh
- iOS: Comet -> Zeron targets/dirs, bundle id sh.zeron.Zeron, zeron:// scheme
- clients default to https://edge.zeron.sh; installer + landing on zeron.sh
- kept on purpose: repo name, worker names (comet-native-edge/comet-landing;
DO storage is bound to the script name), R2 bucket names, and legacy
comet.zeron.sh routes so 0.1.x clients keep working
zeron-<ver>-* artifacts don't exist until the next release, so curl-install
and landing downloads 404 between this deploy and the 0.2.0 tag.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The terminal viewport was an experiment and is no longer maintained.
comet_proto::{view,motion} stay in proto: pure, viewport-independent
derivations with their own test suite remain the right structure.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements phases 1-2 of docs/memory-plan.md (full audit + benchmarks in
the doc). Highlights:
- DocHost: 12-warm-doc LRU with pins (watched / live writer / host-owed
commands), lazy transcript mirror, eviction on DeleteChat/DeleteSpace.
Reopen from snapshot measured within ~11ms of a warm doc.
- WatchDocMessages: delta frames (reset + entry upserts + text appends)
instead of whole-transcript per 120ms tick — 257MB -> 2.3MB measured
over one 1.6MB streamed reply. Wire break: viewport and its attached
engine must be on the same version.
- Attachment images: 64MB LRU over encoded bytes, gpui asset release on
eviction, staged-attachment purge on chat delete.
- Churn: in-place event fold (was O(n^2) per turn), container-scoped doc
reads, single-row workspace chat() on the is_host path.
- mimalloc in both binaries; bounded RPC stream queues; offline room
queue drained during backoff; codex/journal-fd/dial-lock hygiene.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>