Skip to content

Collect garbage before each soak memory sample - #46

Merged
egeominotti merged 1 commit into
mainfrom
fix/soak-gc-before-measure
Oct 1, 2026
Merged

egeominotti merged 1 commit into
mainfrom
fix/soak-gc-before-measure

Conversation

@egeominotti

@egeominotti egeominotti commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Problem

Quality (runtime-d) failed on #44 with "Agent memory footprint grew by more than 128 MiB after warmup" (153 MiB), unrelated to that PR. The samples showed a plateau (110 → 193 → 193 MiB), not a leak. The leak budget measured memory without collecting garbage, so the reading depended on GC timing.

Reproduced on Linux (oven/bun:1.4.2 in Docker), with the same run three times: growth 87, 53, 110 MiB.

Fix

scripts/resilienceAgent.ts (test harness only) forces Bun.gc(true) before each metrics sample, so the budget measures retained memory. A real leak is retained memory and is still caught; the noise floor drops.

Linux, four runs after the change: growth 26, 12, 18, 25 MiB. macOS stays at 0. The 128 MiB budget is unchanged.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Resilience metrics now report memory usage after a forced garbage collection, reducing measured growth from 53–153 MiB to 12–26 MiB.
  • Documentation
    • Added an unreleased changelog entry describing the updated memory measurements.

The soak run's leak budget compared memory samples taken without a
collection, so the reading depended on when the collector last ran. On
Linux the same run measured 53 to 153 MiB of growth, and CI failed at
153 (budget 128) with a stable plateau, not a leak.

Force a full collection before each metrics sample. Retained memory, the
only thing a leak produces, is unaffected; measured growth on Linux is
now 12 to 26 MiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 85638a07-4c2d-4bf6-bb92-0b86c999e270

📥 Commits

Reviewing files that changed from the base of the PR and between 5406820 and d948321.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • scripts/resilienceAgent.ts
 _________________________________________________
< Keeping your code so clean, you can eat off it. >
 -------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@egeominotti
egeominotti merged commit 97558e6 into main Oct 1, 2026
23 of 24 checks passed
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