fix: reduce memory and disk usage from harness subprocess artifacts#16
Merged
Conversation
Railway deployment investigation revealed 7 GB RSS and 2.7 GB disk waste from accumulated Claude Code session data, V8 JIT .so files, and Python heap fragmentation after reviews. Memory fixes: - Set MALLOC_TRIM_THRESHOLD_=0 so glibc returns freed pages to OS - Call malloc_trim(0) via ctypes after each review completes - Clear evidence_map and verification_map after use in review layer - Only extract evidence for new gap findings in coverage loop (was re-extracting for ALL accumulated findings each iteration) - Explicit del of gap_evidence between coverage iterations Disk fixes: - Snapshot Claude session dirs before review, delete only new ones after (safe for concurrent reviews — each cleans only its own sessions) - Clean empty pyright-* temp dirs from /tmp after reviews - Remove orphaned V8 .so files older than 60s from /tmp Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.claude/projects/), V8 JIT.sofiles (~106 MB in/tmp), and pyright temp directoriesChanges
Memory (heap)
MALLOC_TRIM_THRESHOLD_=0env var in Dockerfile so glibc aggressively returns freed pagesmalloc_trim(0)called via ctypes after each review's GC passevidence_mapandverification_mapexplicitly cleared after use in_run_review_layerdel gap_evidencebetween coverage iterationsDisk (session artifacts)
~/.claude/projects/before review, deletes only sessions created during this review afterward (safe for concurrent reviews)pyright-*temp dirs cleaned from/tmp.sofiles older than 60s removed from/tmp(age threshold protects concurrent harness calls)Investigation findings
.claude/projects/session data.opencode/bin//tmp/*.soV8 artifacts/tmp/pyright-*dirs.npm+.buncachesTest plan
ruff checkpasses on all changed filestest_staggered_gather.py)PYTHONPATH=src🤖 Generated with Claude Code