How do I limit RAM consumption of a particular executable?

9,912

Solution 1

It's possible. You need to create a watchdog process monitor rule to limit the memory usage of the executable.

  • Just as @wp78de said, setting too low value, may cause the process to "hang" or crash.

    To automate the process you could use ProcessLasso to create a process watchdog rule to regularly trim the "virtual memory" (the private memory used by the process).

  • Open ProcessLasso GUI, right click the target executable and select "Set watchdog rule for this process"

    You can choose a reasonable value depending on how much the process used before. Some processes indeed leak memory resulting in wastage of RAM, so by trimming the memory you are actually optimising RAM usage.

Solution 2

This is a complicated matter and the cure is more likely to cause more trouble than the disease. Since if the app in question runs out of memory it will most likely crash (even a BSOD is possible).

Anyway, citing Clint Huffman answering the very same question:

The answer is it largely depends on the overall physical memory usage, but it can be limited.

He explains a bit of the background of the amount of physical memory that a process uses, which is called Working Set. Most interestingly for you is the following

there is a tool called the Windows System Resource Manager which can limit the amount of working set that a process uses. This tool is installable (not installed by default) through the Add Features console on Windows Server 2008 R2.

This component is meant for Windows Server versions. However, you should be able to install it on newer non-server versions of Windows as well (see Clint's last comment). But there is no guarantee. You can find the WSRM here.

To mimic memory constraints, you could use a virtual machine with a limited amount of RAM, but I guess that's not what you want. On Client versions (and newer server versions) WSRM was replaced with the Performance Monitor, which does not have memory limiting capabilities (AFAIK).

If you have memory problems with an app that can be easily replaced with an alternative that adheres more to your memory constraints, you should switch. E. G. current articles recommend Firefox as the least memory hungry browser.

Share:
9,912

Related videos on Youtube

user400424
Author by

user400424

Updated on September 18, 2022

Comments

  • user400424
    user400424 over 1 year

    Microsoft Edge eats up RAM like crazy and I want to scale it back a bit. I don't care if it makes browsing on it laggyer, I just want to have my RAM distributed evenly to my open programs.

    The particular executable I want to limit is C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdgeCP.exe. That seems to be the child process that has the majority of the RAM consumption. It's also open multiple times at the same time just like Chrome

    • Ramhound
      Ramhound over 6 years
      If Edge uses to much memory for your taste, is there a reason you are using it, instead one of the other browsers that exist? There really isn't a waste to disallow memory usage by a program. The only way to do that would be to boot Windows with and tell is less memory exists, but that wouldn't solve the problem, because you would end up just having less memory and the problem would be worse then it already is.
    • Ramhound
      Ramhound over 6 years
    • user400424
      user400424 over 6 years
      @Ramhound it's the only browser that fits the aesthetic of Windows 10 out of the box
  • user400424
    user400424 over 6 years
    Does setting a hard limit like 3072mb (3gb) make it apply to all the processes with the same name? MicrosoftEdgeCP.exe has multiple processes and I want to limit the memory for all of them in total, not for each instance of it.
  • xavier_fakerat
    xavier_fakerat over 6 years
    Yes, it applies to all the processes from the executable tree e.g chrome.exe (which may have 6 or so chrome.exe processes), all of them are catered for by the process watchdog rule
  • user400424
    user400424 over 6 years
    that doesn't seem to be the case though? I tried lowering the bar to something ridiculous like 256mb and I tried opening multiple tabs thus having multiple instances of MicrosoftEdgeCP.exe and the combined memory usage is clearly above 256mb yet it didn't trigger at all. It just triggered when one of the many instances actually hit that amount. So it IS per instance and not in total.