There's a memory leak in VS2015's StandardCollector.Service.exe, which is acknowledged by Microsoft, but it won't be fixed until the next Service Pack.

So in the meantime I get a warning from Windows that memory is low and I find out it has exceeded 7 GB of RAM and I kill it. I'd like to be able to automate that.


  • Works on Windows.
  • Allows you to specify the process by executable path.
  • Allows you to specify how much RAM it should exceed before being killed.
  • Is free.

There's a similar (unanswered) question here - Choose which program(s) should be killed when out of RAM, but it's different in that I don't want to wait until overall system memory becomes slow, I just want to monitor that process's RAM.

Also there is a question in AskUbuntu that asks basically the same, but I need it for Windows, not for Linux.

1 Answer 1


You can try to clear the working set instead of killing the process itself.

Use EmptyWorkingSet() to clear the RAM usage of an application or set its maximum value using SetProcessWorkingSetSize()

I had a similar problem, you could extend this program which currently needs the process id instead of the executable path and put it in a loop to periodically clear the working set of the specified process id every 60s:

  mem_min 1234
  timeout 60
goto loop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.