Created
December 31, 2018 17:53
-
-
Save Fak3/3c6bf52000651b00d9ab03e5b6bae677 to your computer and use it in GitHub Desktop.
ramhog.py
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
from time import sleep | |
print('Press ctrl-c to exit; Press enter to hog 100MB more') | |
one = b'Z' * 1024 * 1024 # 1MB | |
hog = [] | |
while True: | |
hog.append(one * 100) # allocate 100MB | |
free = '; '.join(open('/proc/meminfo').read().split('\n')[1:3]) | |
print(f'{free}; Press enter to hog 100MB more', end='') | |
input() | |
sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment