Skip to content

Instantly share code, notes, and snippets.

Created Dec 31, 2018
What would you like to do?
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='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment