On macOS `Process.PrivateMemorySize64` returns `0`
#105.665 aberto em 29 de jul. de 2024
Métricas do repositório
- Stars
- (17.886 stars)
- Métricas de merge de PR
- (Mesclagem média 12d 11h) (661 fundiu PRs em 30d)
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