Thanks to visit codestin.com
Credit goes to github.com

Skip to content

1.4.0rc1: Python-level memory "leak" (internal font cache?) #3264

Closed
@letmaik

Description

@letmaik

I'm currently testing the 1.4.0rc1 (had to change the min_version of freetype2 to 1.3, see #3262). It seems that the memory leak reported in #3197 is gone, but I still see a very slow but considerable increase in resident memory, and in fact I can observe a constant Python object count growth of the following classes:

__builtin__.list 14645  +114
__builtin__.dict    18076   +114
matplotlib.font_manager.FontProperties  761 +114

(measured using objgraph)

So I think between 1.3.1 and 1.4.0rc1 some kind of new "leak" appeared on Python level. It's not a real leak as the objects are accessible, so I guess it's a kind of internal font (property) cache which doesn't clear up old entries.

Test script:

import numpy as np
import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt

for i in range(100000):
    fig, ax = plt.subplots()         

    circle1=plt.Circle((0,0),2,color='r',rasterized=True)
    ax.add_artist(circle1)

    fig.savefig('test.svg')
    plt.close(fig)

EDIT: I had measured object count growth for 1.3.1 also, and there was no growth of any class there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions