Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1080371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:01:11+00:00 2026-05-16T22:01:11+00:00

Trying to programmatically get the private working set of a process. Currently I am

  • 0

Trying to programmatically get the private working set of a process.

Currently I am able to get the working set without issue but having trouble getting the private working set.

Here’s method:

private void GetProcessesForServer(string serverName)
{
    var runningProcesses = new Process[0];

    try
    {
        runningProcesses = Process.GetProcesses(serverName);

    }
    catch (Exception e)
    {
        ResultsPanel.Controls.Add(new Label { Text = string.Format("There was an error: {0}", e.GetBaseException().Message) });
    }

    IOrderedEnumerable<CustomProcess> processes = runningProcesses
        .Select(process => new CustomProcess(process.Id, process.ProcessName, (process.WorkingSet64 / 1024)))
        .ToList()
        .OrderBy(process => process.ProcessName);

    if (processes.Count() > 0)
        ResultsLabel.Text = string.Format("Current running processes on {0}", ServerNamesDropDown.SelectedItem.Text);

    ResultsGridView.DataSource = processes;
    ResultsGridView.DataBind();
}

So I’m passing in a server name then trying to get all the running processes for that server then binding the list of processes to a grid view. Everything works without any issues however I need to get the private working set – similar to what you see in Windows Task manager – rather than the total working set.

Many thanks,
Tim

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:01:11+00:00Added an answer on May 16, 2026 at 10:01 pm

    On Windows Vista and beyond there is the “Working Set – Private” performance counter in the “Process” category (see msdn).

    Given you are on such a platform you could use the System.Diagonstics.PerformanceCounter class to query this information.

    To establish a link between a process ID and a given performance counter instance, use the “ID Process” counter of a category. In other words: lookup the instance where the “ID Process” counter is your desired process ID, the read the value of the “Working Set – Private” counter.

    Hint: if you need to query all values for all processes use the System.Diagonstics.PerformanceCounterCategory.ReadCategory() call instead, as it is much faster the reading individual counters for all processes/instances.

    Update: There is an article on codeproject that shows how to calculate that value on XP/2000, if you must. I have not tested it, so don’t blame me 😉

    Update 2: You may also want to checkout this stackoverflow question/answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to reflect over some class properties and set them programmatically, but it
I am trying to get to grips with programmatically configuring views. I have a
I am trying to work with a UIImageView programmatically and can't get it to
Im trying to submit a specific form programatically, but I allways get the initial
I'm trying to unit test a custom ConfigurationElementCollection , but I'm having a problem
I'm trying to programmatically get a list of ElastiCache endpoints from my Java app
I'm trying to programmatically set the constructor sting of a COM+ component from a
I am trying to get some JavaScript to programmatically adjust a HTML img tag's
I am programmatically trying to get latitude and logitude for an address on a
Hy, i'm trying to create a refund programmatically : //get order magento $orderMagento =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.