Created
June 15, 2015 12:03
-
-
Save Sorseg/400fe412268b0b798c28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import wmi, time | |
def watch(): | |
c=wmi.WMI() | |
pss = c.query("select WorkingSetSize from win32_Process" | |
" where Name='chrome.exe'") | |
killed = [p.Terminate(0) for p in pss if int(p.WorkingSetSize) > 1800*1e6] | |
if killed: | |
print ("SOMEONE GOT KILLED") | |
mem = sum(int(p.WorkingSetSize) for p in pss) | |
return mem | |
if __name__ == '__main__': | |
while 1: | |
print(watch()/1e6) | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment