Skip to content

Suppress recovered rapid heap growth warnings - #2472

Merged
kojiwakayama merged 1 commit into
mainfrom
fix/memory-profiler-sustained-growth
Jun 16, 2026
Merged

kojiwakayama merged 1 commit into
mainfrom
fix/memory-profiler-sustained-growth

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Summary

  • Delay Rapid heap growth detected by one memory-monitoring interval and only warn if heap remains more than 100MB above the pre-spike baseline.
  • Preserve the existing warning message for sustained growth, while adding observedGrowthMB to distinguish the original spike from the sustained delta.
  • Bump deno.json and src/utils/version-constant.ts from 0.1.817 to 0.1.818.

Runtime evidence addressed

The production sample from #3200 showed a cold render/cache warmup spike from 99.16MB to 212.69MB, then recovery to 153.01MB on the next sample. This change suppresses that recovered one-interval spike but still alerts when the next sample remains over the 100MB sustained-growth threshold.

Test plan

  • Red/green regression: deno test --no-check --allow-all src/utils/memory/profiler.test.ts
  • deno test --no-check --allow-all src/utils/version.test.ts src/utils/logger/logger.test.ts src/utils/memory/profiler.test.ts
  • DENO_NO_PACKAGE_JSON=1 deno lint src/utils/memory/profiler.ts src/utils/memory/profiler.test.ts
  • deno check src/utils/memory/profiler.ts src/utils/memory/profiler.test.ts
  • deno task typecheck
  • deno task test:unit passed: 2167 tests, 18661 steps.
  • git push pre-push checks passed: formatting, lint, typecheck, unit tests.

Known repo gate

  • deno task verify:quick currently stops at pre-existing lint:cli-boundary violations in cli/shared/server-startup.ts, unrelated to this diff.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49930cc7d1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/utils/memory/profiler.ts Outdated
@kojiwakayama
kojiwakayama force-pushed the fix/memory-profiler-sustained-growth branch from 49930cc to 342d1b7 Compare June 16, 2026 12:21
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

Addressed the inline feedback about restart baselines.

startMemoryMonitoring now seeds the rapid-growth baseline from the current heap via getInitialRapidHeapGrowthState(getHeapStats().usedHeapSizeMB) instead of resetting lastHeapUsed to zero. Added a regression test for the stable warm-heap restart case so a 153MB heap that remains flat does not create a pending spike or sustained warning.

Verification after the update:

  • deno test --no-check --allow-all src/utils/memory/profiler.test.ts
  • DENO_NO_PACKAGE_JSON=1 deno lint src/utils/memory/profiler.ts src/utils/memory/profiler.test.ts
  • deno check src/utils/memory/profiler.ts src/utils/memory/profiler.test.ts
  • deno task typecheck
  • pre-push checks passed: formatting, lint, typecheck, unit tests (2167 passed, 18662 steps).

@kojiwakayama
kojiwakayama merged commit ee10dd9 into main Jun 16, 2026
17 checks passed
@kojiwakayama
kojiwakayama deleted the fix/memory-profiler-sustained-growth branch June 16, 2026 12:30
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