Skip to content

perf(code-index): bound pre-seat text projection memory below admission budget #852

Description

@ScriptedAlchemy

Defect

The preserved operator profile on exact pushed PR #707 commit 250c5e01b reached 26.31 GiB RSS before any project graph engine opened, sealed-store publication occurred, or a graph generation seated. This is a pre-seat text/code-index projection working-set defect, distinct from #799's retained Grafeo-engine peak and #830's post-publication release boundary.

Observed live progression for generation 29:

  • 1.82 → 8.58 → 13.15 → 18.97 → 22.36 → 23.74 → 26.31 GiB RSS
  • graph file remained 2,361,815,040 bytes with no WAL
  • shutdown cancelled inside the published text loop; the graph gate is evaluated only afterward
  • profile was preserved and the daemon was stopped through its normal lifecycle before OOM

A prior Hotpath allocation capture on the same ~4–5k-file shape attributes the largest overlapping owners to:

  • code_index.generation.decode.bundle: 7.4 GB
  • publish.segment_encode: 10.8 GB
  • decode.segment: 1.7 GB
  • restore.file_admit: 1.4 GB
  • incremental materialization: 1.1 GB
  • load_active deep clone: 533 MB

The decoded active generation, restored file artifacts/evidence, incremental candidate, whole-generation encoder payload/segment/index marker buffers, and one text-source batch can coexist. The current 1.5 GiB ledger bounds only batch/cache estimates; it does not account for the decoded generation, encoder, SQLite/allocator overhead, or arena retention. 0a3642dd4 only changes scheduling throughput and 63777d1d0 only improves diagnostics; neither bounds these owners.

Required outcome

  • Decompose and eliminate overlapping whole-generation owners across decode, active-generation loading, incremental materialization, partitioned sealing, and text publication.
  • Preserve exact generation/source identity, content-addressed validation, cancellation, rollback, and the existing admission ceiling.
  • Make the actual end-to-end working set observable and admission-accounted; do not raise limits or mask the failure with stale RSS telemetry.
  • Keep perf(code-index): make incremental capture and seal delta-proportional #800's delta-proportional persistence work distinct, but reuse it where it genuinely deletes whole-generation work.

Acceptance evidence

  • A scale regression that includes active-generation decode, one-file incremental materialization, segment sealing, and text publication—not an isolated batch estimator.
  • Hotpath/allocator evidence showing the former whole-generation buffers no longer overlap.
  • Re-run the preserved-profile generation-29 journey: peak and settled RSS remain below the existing 18.84 GiB high watermark and the generation reaches its truthful seated state without daemon restart.
  • Existing tamper, restart, cancellation, rollback, and exact-generation tests remain green.

Related: #799, #800, #830, #847.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions