Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Dmitry Sichkar dmmeteo

I may be slow to respond.
View GitHub Profile
dmmeteo /
Created Jul 15, 2020 — forked from vald-phoenix/
A dummy decorator function to measure memory usage of a Python function, method, etc.
import resource
from functools import wraps
def mem_it(func):
def wrapper(*args, **kwargs):
'Pre-memory usage: {} (mb)'.format(
resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024