Skip to content

Fix process memory in code --status - #331297

Open
Kumar Abhinav (Abhinav0905) wants to merge 2 commits into
microsoft:mainfrom
Abhinav0905:agent/fix-code-status-memory
Open

Kumar Abhinav (Abhinav0905) wants to merge 2 commits into
microsoft:mainfrom
Abhinav0905:agent/fix-code-status-memory

Conversation

@Abhinav0905

Copy link
Copy Markdown

Fixes #331296

Related to #194322 and #331139.

What changed

  • Treat ProcessItem.mem consistently as bytes when formatting the code --status process table.
  • Document the byte-valued ProcessItem.mem contract.

Root cause

listProcesses already converts non-Windows %mem values to bytes, but DiagnosticsService.formatProcessItem applied the old percentage-to-bytes calculation a second time on macOS and Linux. This produced impossible values such as 25,332,747,904 MB for a process with about 94 MiB RSS.

The Process Explorer already formats item.mem as bytes. This change makes the diagnostics text path consistent with that behavior.

PR #331139 changes the macOS source metric from RSS to physical footprint but continues to store the result in bytes, so the two fixes are compatible and address separate output paths.

Validation

  • Reproduced on VS Code 1.133.0, macOS 26.5.1 arm64.
  • TypeScript syntax transpile passed for both changed files.
  • git diff --check passed.
  • Confirmed the patch applies cleanly to current main at 4ccdb71a3e5.

Copilot AI balanced review requested due to automatic review settings August 17, 2026 19:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates process memory reporting to treat ProcessItem.mem consistently as bytes and simplifies diagnostics output formatting accordingly.

Changes:

  • Remove platform-specific memory conversion logic in diagnostics output and always render mem as MB from bytes.
  • Document ProcessItem.mem as “Memory usage in bytes.”

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/vs/platform/diagnostics/node/diagnosticsService.ts Simplifies diagnostics table output by assuming ProcessItem.mem is already in bytes.
src/vs/base/common/processes.ts Documents the mem field’s unit as bytes to clarify the API contract.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/base/common/processes.ts Resolved
@Abhinav0905

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@Abhinav0905
Kumar Abhinav (Abhinav0905) marked this pull request as ready for review August 17, 2026 20:00
@Abhinav0905

Copy link
Copy Markdown
Author

Hi Robo (@deepak1556), this is ready for human review. The change makes the code --status memory calculation use the ProcessItem.mem byte contract consistently, then converts bytes to MB once in diagnostics output. The dependency and CLA checks pass. Could you confirm whether this matches the current process-tree producers? I can add or adjust focused coverage if you prefer.

@Abhinav0905

Copy link
Copy Markdown
Author

Hi Robo (@deepak1556), following up on the August 28 note. The change is still limited to treating ProcessItem.mem as bytes and converting it to MB once in diagnostics output. The CLA and dependency checks pass, while the required PR check is still awaiting maintainer approvals. Could you confirm the byte contract or point me to the right owner for review?

@Abhinav0905

Copy link
Copy Markdown
Author

Hi Robo (@deepak1556), could this focused two-file fix get a review soon, or could you point me to the right owner? The branch is current with main, the CLA and dependency checks pass, and the earlier Copilot questions have been answered. I am available to make any requested changes quickly.

@Abhinav0905

Copy link
Copy Markdown
Author

Hi Robo (@deepak1556), I've updated the branch with the latest main. This remains a focused two-file fix for the double memory conversion in code --status, and the earlier review questions have been answered. Could you please take a look when you have a chance and help unblock the required checks? If everything looks good once the checks pass, I'd appreciate a merge. I'm happy to address any further feedback. Thank you!

@Abhinav0905

Copy link
Copy Markdown
Author

Hi Robo (@deepak1556), I rechecked this against main. GitHub reports no merge conflict, but VS Code PR Check is still marked in progress on the October 28 run. Could you take a look and let me know if the check needs a rerun or if there's anything I should change? Thanks!

This branch has not been deployed

No deployments
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.

code --status multiplies process memory twice on macOS and Linux

3 participants