Skip to content

Physical memory larger than virtual memory on Windows #1208

Open
@BTOdell

Description

@BTOdell

Describe the bug
OS: Windows 10
sysinfo version: v0.30.5

When running a small Rust binary that uses sysinfo to print out process stats, I noticed that the reported virtual memory is ~5MB but the physical memory is ~15MB. According to the docs, virtual memory should always include the physical memory size and then add additional address space from paged regions, etc.

Here is what Resource Monitor shows for the process:
image

This is what Task Manager shows:
image

The "Private" memory is what Windows considers to be the uniquely allocated memory of the process:
image

I looked into the Windows code here and I think there is a case to be made to use a different value than WorkingSetSize for the physical memory of the process.

The question is how is this value calculated? It seems to be the "Working Set Size" minus the "Shareable" memory.
Thoughts?

To Reproduce

Run a small Rust app that prints out the virtual and physical memory using sysinfo.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions