Log process memory at the end of each collection cycle#956
Merged
Conversation
Lite has had no internal record of its own memory usage. Bug reporters (see #933) had to read it off Task Manager, and we had no historical trace for diagnosing growth patterns. After every collection cycle — which is also after archival and retention run, so it captures the quiescent state — log: Process memory: WS=XXX MB, Private=XXX MB, GC heap=XXX MB WS is Working Set (what Task Manager shows). Private is private bytes (unique to this process, the more honest "actual RAM cost" number). GC heap is .NET-managed memory only — together with WS-Private this splits managed vs native vs shared. One INFO log line per minute. Three property reads — negligible overhead. Errors swallowed at DEBUG level (don't ever break the collection loop because we couldn't read memory stats). Co-Authored-By: Claude Opus 4.7 (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
Add a single
INFOlog line at the end of every collection cycle reporting Working Set, Private Bytes, and GC heap.Why
Two-fold motivation, both surfaced by #933:
Implementation
CollectionBackgroundService.LogProcessMemory()— three property reads, called afterRunArchivalIfDueAsyncandRunRetentionIfDueso it captures the cycle's quiescent state, not a mid-archival spike.DEBUGlevel so a transient inability to read process stats never breaks the collection loop.Output
One line per minute, format:
WS= working set (what Task Manager shows)Private= private bytes (unique-to-process, the honest "actual RAM cost")GC heap= .NET managed heap only —WS - Private - GCis rough native/shared overheadTest plan
🤖 Generated with Claude Code