Skip to content

Fix #846: Add RAM to environment summary#3038

Merged
timcassell merged 5 commits intodotnet:masterfrom
abdulrahmanhossam:feature/issue-846-ram-summary
Mar 2, 2026
Merged

Fix #846: Add RAM to environment summary#3038
timcassell merged 5 commits intodotnet:masterfrom
abdulrahmanhossam:feature/issue-846-ram-summary

Conversation

@abdulrahmanhossam
Copy link
Contributor

Resolves #846.

This PR adds the total physical memory (RAM) to the environment summary, appending it directly to the CPU information line to keep the summary compact and readable.

Implementation details:

  • Windows: Uses GlobalMemoryStatusEx via P/Invoke.
  • Linux: Reads MemTotal from /proc/meminfo.
  • macOS: Uses sysctl -n hw.memsize process output.

The total memory is formatted in GB (e.g., 16 GB RAM). I used Lazy<T> to ensure the OS is only queried once and doesn't impact performance.

Let me know if any adjustments are needed!

@timcassell
Copy link
Collaborator

timcassell commented Mar 2, 2026

RAM is not part of the CPU technically. Just make it a new line (yield return it separately). Also, if the info is available, it could be useful to include the frequency of the RAM, and type (DDR4/5).

@timcassell
Copy link
Collaborator

Also free or used memory if possible (see #847 convo regarding it).

@abdulrahmanhossam
Copy link
Contributor Author

thanks for the lightning-fast review!

  1. You are absolutely right, it makes much more sense on a separate line. I will update this right away.
  2. I will also update the implementation to include the Available/Free memory alongside the Total memory as discussed in the Added Memory Information - Free and Total memory for different platforms #847 thread.
  3. Regarding the RAM Frequency and Type (DDR4/5): Gathering this accurately cross-platform natively in C# is quite complex without external dependencies (e.g., parsing dmidecode on Linux often requires sudo, and system_profiler on macOS is quite heavy). Would it be acceptable to scope this PR to Total/Available memory first, and perhaps track the hardware details (Frequency/Type) in a separate future issue?

Let me know if this sounds like a good plan, and I'll push the updates shortly!

Copy link
Collaborator

@timcassell timcassell left a comment

Choose a reason for hiding this comment

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

Doing a separate issue/PR for those is ok. Thanks @abdulrahmanhossam

@timcassell timcassell merged commit ed1c304 into dotnet:master Mar 2, 2026
11 checks passed
@timcassell timcassell added this to the v0.16.0 milestone Mar 2, 2026
@abdulrahmanhossam abdulrahmanhossam deleted the feature/issue-846-ram-summary branch March 2, 2026 20:56
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.

Add RAM to summary

3 participants