Setting Memory Priority via Sysinternals

Liam Bowen 1 Reputation point
2022-10-18T19:53:35.523+00:00

In Sysinternals, the Process Explorer utility can display memory priority (seems to default to 5) and it can both display and set the process (i.e., CPU) priority. Is there any utility that can set the memory priority?

Sysinternals
Sysinternals
Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
1,169 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. KurtBMayer 836 Reputation points
    2022-10-18T21:30:58.56+00:00

    @Liam Bowen

    wmic process where name="CalculatorApp.exe" CALL setpriority "above normal"  
      
    or  
      
    $ProcessName = 'CalculatorApp'  
    $process = Get-Process -Name $ProcessName  
    $process.PriorityClass = 'BelowNormal'  
    

    See these for more examples:
    How to change the priority of a Windows 10 process using Command line?
    Process Priority Management in Windows

    Please upvote or accept this thread as answered if it's helpful, thanks!


  2. Michael Taylor 54,811 Reputation points
    2022-10-18T21:39:14.74+00:00

    I'm really curious why you are remotely interested in changing the memory priority of a process. The priority of memory simply determines how important that page of memory is when trimming. There is really no way for you to make that determination yourself as you didn't write the app nor do you know how the app is using the memory. Changing the priority does not impact how much memory is being used by the process and, in fact, may cause performance to get worse if the program is constantly being trimmed.

    This low level feature is really designed for programs to use to prioritize their memory usage. For example an app that loads files into memory for perf reasons may mark the thread that manages that memory with a lower priority so it gets written out more frequently than the core process memory. This would be a really extreme example of perf optimization and outside perhaps database apps or similar highly performant programs I cannot imagine why you would ever change this. It gets harder if you have multiple threads working with the same memory because I suspect it is the thread that allocated the page of memory whose priority is used. The process-level priority simply sets the default priority for the threads it creates.


  3. Castorix31 85,881 Reputation points
    2022-10-20T05:01:18.93+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.