Reputation: 2692
I have a long-running CPython 3.8 process. After a while, it's using a huge amount of RAM. I have tried
import gc
import psutil
from pympler import muppy, summarize
gc.collect()
total_ram = psutil.Process().memory_info().rss
all_objects = muppy.get_objects(include_frames=True)
s = summary.summarize(all_objects)
python_objects_size = sum(row[2] for row in s)
Output: 102 MiB Python objects, 824 MiB RSS memory!
[EDIT] 3. using tracemalloc; which also returns ~100MiB worth of python objects
[EDIT 2] export PYTHONMALLOC=malloc
does not solve the problem.
Is there a way to query the CPython memory manager to figure out
Upvotes: 7
Views: 732