kill process if it exceeds 6GB

Viewed 2962

Currently on windows server, some process is running and it keeps on consuming memory. I want to kill the process if it exceeds specific limit e.g. process should be killed if it exceeds 6 GB memory usage. I'm looking for batch script which could be added to scheduled task. Any help on this? Thanks a lot in advance.

2 Answers

Kill process java.exe if memory usage more than 6Gb

taskkill /F /FI "memusage gt 6144000000" /IM java.exe

Kill any process if them memory usage more than 6Gb

taskkill /F /FI "memusage gt 6144000000"

PS: Manual

Related