Skip to content

Instantly share code, notes, and snippets.

@tot-ra
Created March 14, 2023 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tot-ra/3b096e8e051eaa6733660509ec541a23 to your computer and use it in GitHub Desktop.
Save tot-ra/3b096e8e051eaa6733660509ec541a23 to your computer and use it in GitHub Desktop.
import psutil
import threading
if is_local_env():
def print_memory_usage():
process = psutil.Process()
while True:
logger.debug("Memory usage: %d mb", process.memory_info().rss / (1024 * 1024))
time.sleep(1)
memory_thread = threading.Thread(target=print_memory_usage)
memory_thread.daemon = True
memory_thread.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment