Skip to content

docs: VIEWER_MEMORY_LEAK.md — §SQLJS_CLOSE + §STAFFAGE_TEX_CAP findings (bim-ootb #1488) - #89

Merged
red1oon merged 1 commit into
masterfrom
docs/viewer-memleak-sqljs-notes
Aug 23, 2026
Merged

docs: VIEWER_MEMORY_LEAK.md — §SQLJS_CLOSE + §STAFFAGE_TEX_CAP findings (bim-ootb #1488)#89
red1oon merged 1 commit into
masterfrom
docs/viewer-memleak-sqljs-notes

Conversation

@red1oon

@red1oon red1oon commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Appends the dated section ## 2026-08-23 — sql.js instance leaks + staffage texture cache to the canonical viewer-memory doc, covering the bim-ootb hardening shipped as red1oon/bim-ootb#1488 (merged):

  • New resource class for the file's disposal checklist: sql.js SQL.Database WASM-heap instances — reassignment-without-.close() orphans the full DB copy (100-250MB) in a heap neither GC nor renderer.info reaches.
  • Reachability verdict, traced not assumed: every A.db/A.libDb/A.cityDb reassignment site fires at most once per page life (Ctrl+O replace navigates; merge folds into the live DB; city switches swap cached references) — shipped as dormant defensive hardening, explicitly NOT claimed as a leak fix.
  • The aliasing trap: A.libDb === A.db through most of the split load — a naive close guard would have closed the live meta DB; conversely the alias sites are where a re-entry would orphan a separate 116MB geo instance. Alias-aware guards, witnessed 3-cycle on Duplex (single-DB) + Clinic (split): prior instances provably closed (exec throws "Database closed"), counts stable, renderer counters flat cycle-over-cycle, 0 page errors.
  • _staffageTexCache: bounded 12-file roster + documented session-lifetime design → dormant 2x-roster size cap chosen over both candidate clear-triggers (rationale in the section); dedup proven intact (exactly 12 texture loads across preload + 2 Alt+P presses, 0 evictions).

Note for the merger: master does not yet carry prompts/VIEWER_MEMORY_LEAK.md — its history lives on the unmerged working line (last touched by 1912b6583). This PR introduces the file at that line's current content (418 lines, byte-identical) plus the new 60-line section, so either merge order converges on the same text.

No auto-merge armed.

🤖 Generated with Claude Code

…TAFFAGE_TEX_CAP (bim-ootb #1488)

Appends the 2026-08-23 section: sql.js SQL.Database WASM-heap instances as a new
resource class for this file's disposal checklist; reachability traced (all
A.db/A.libDb/A.cityDb reassignment sites are once-per-page-life — dormant
hardening, not an active leak); the libDb-aliases-db trap; the staffage texture
cache's bounded-roster analysis and why a dormant size cap beat both candidate
clear-triggers; full witness numbers (Duplex + Clinic 3-cycle re-init proof,
116MB geo instance provably closed).

NOTE: master does not yet carry this file (its history lives on the unmerged
working line, last touched by 1912b65) — this commit introduces it at that
line's current content plus the new section, so either merge order resolves to
the same text.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@red1oon
red1oon merged commit b01d861 into master Aug 23, 2026
1 check failed
@red1oon
red1oon deleted the docs/viewer-memleak-sqljs-notes branch August 23, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant