Skip to content

Instantly share code, notes, and snippets.

@timotewb
Created January 1, 2021 09:39
Show Gist options
  • Save timotewb/2358525fec9465f4b0145294c7a21327 to your computer and use it in GitHub Desktop.
Save timotewb/2358525fec9465f4b0145294c7a21327 to your computer and use it in GitHub Desktop.
def clearRAM(print_usage=False):
import os
from hurry.filesize import size
import psutil
import gc
#--- clear ram
gc.collect()
#--- print usage
if print_usage == True:
process = psutil.Process(os.getpid())
print(size(process.memory_info().rss))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment