Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new Process object only once in Resource Monitoring Windows #5588

Closed
evgenyfedorov2 opened this issue Oct 31, 2024 · 3 comments
Closed

Comments

@evgenyfedorov2
Copy link
Contributor

GetCurrentProcessMemoryUsage method creates a new Process object on every method call:

public ulong GetCurrentProcessMemoryUsage()
{
    using Process process = Process.GetCurrentProcess();
    return (ulong)process.WorkingSet64;
}

Instead, it could have created it once and then reusing it for the application lifetime. This should improve performance.

@haipz
Copy link
Contributor

haipz commented Nov 2, 2024

This might hit performance issue:
Image

@makazeu
Copy link
Contributor

makazeu commented Nov 3, 2024

Not sure why GetCurrentProcess is really cpu-heavy

@evgenyfedorov2
Copy link
Contributor Author

Fixed in #5597

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

No branches or pull requests

4 participants