[Python-Dev] Investigating Python memory footprint of one real Web application

INADA Naoki songofacandy at gmail.com
Tue Jan 24 10:33:53 EST 2017


On Tue, Jan 24, 2017 at 11:08 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> 2017-01-24 15:00 GMT+01:00 INADA Naoki <songofacandy at gmail.com>:
>> And here are top 3 tracebacks from tracemalloc:
>>
>> 15109615 (/180598)
>>   File "<frozen importlib._bootstrap_external>", line 488
>>   File "<frozen importlib._bootstrap_external>", line 780
>>   File "<frozen importlib._bootstrap_external>", line 675
>>   File "<frozen importlib._bootstrap>", line 655
>
> FYI at Python startup, usually the largest memory block comes from the
> dictionary used to intern all strings ("interned" in unicodeobject.c).
> The traceback is never revelant for this specific object.
>
> Victor

Yes! I used a few hours to notice it.

When PYTHONTRACEMALLOC=10, marshal.loads() of small module (15KB pyc)
looks eating 1.3MB.
I think small stacktrace depth (3~4) is better for showing summary of
large application.

BTW, about 1.3MB of 15MB (mashal.loads()) was for intern dict, as far
as I remember.


More information about the Python-Dev mailing list