Created
July 28, 2020 02:02
-
-
Save colesbury/eb066317ecaf571c9d126c34e8dbde8a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import gc | |
from time import sleep | |
import numpy as np | |
print('allocating memory') | |
pile=[] | |
for i in range(1500): | |
for x in range(4): | |
pile.append(np.ones((256, 64), dtype=np.float32)) | |
pile.append(np.ones((256, 64), dtype=np.float32)) | |
pile.append(np.ones((256,), dtype=np.float32)) | |
pile.append(np.ones((256,), dtype=np.float32)) | |
print('waiting two seconds') | |
sleep(2) | |
del pile | |
print('hypothetically de-allocating memory') | |
gc.collect() | |
print('waiting forever') | |
sleep(1) | |
while True: | |
sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment