Skip to content

On macOS Process.PrivateMemorySize64 returns 0 #105665

Open
@nwoolls

Description

Description

Accessing Process.PrivateMemorySize64 on macOS returns 0. This was initially reported, and fixed, for Linux here. Follow-up comments mention macOS but the issue was closed.

The implementation of AssertNonZeroAllZeroDarwin seems to indicate this is acknowledged, if not by-design. But the XML comments for Process.PrivateMemorySize64 doesn't mention any such limitation.

Not sure if this is a bug or feature request, but I'd love to see this implemented for macOS. We're trying to troubleshoot some memory usage but coming up short in our dev environments because of this.

Reproduction Steps

mkdir app-macos-PrivateMemorySize64
cd app-macos-PrivateMemorySize64
dotnet new console
using System.Diagnostics;

var process = Process.GetCurrentProcess();
Console.WriteLine(process.PrivateMemorySize64);
dotnet run

Expected behavior

Outputs "the amount of private memory, in bytes, allocated for the associated process".

Actual behavior

Outputs 0.

Regression?

No

Known Workarounds

None

Configuration

dotnet --version
8.0.303
sw_vers
ProductName:		macOS
ProductVersion:		14.5
BuildVersion:		23F79
uname -a
Darwin nathanialsmbpm2.lan 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64

Other information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-System.Diagnostics.Processhelp wanted[up-for-grabs] Good issue for external contributorsneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsiderationos-mac-os-xmacOS aka OSX

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions