Files
2025-05-20 11:57:43 -04:00

18 lines
403 B
Python

#!/usr/bin/env python
import os
import psutil
class MemoryChecker():
"""
Callable class to get current memory use of program.
Instances of this class may be called, at which time
they will return current memory use.
"""
def __init__(self):
self.process = psutil.Process(os.getpid()) # <1>
def __call__(self):
return self.process.memory_info().rss # <2>