-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
1.4.0rc1: Python-level memory "leak" (internal font cache?) #3264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is a fantastic example of the "many eyes" situation in On Tue, Jul 15, 2014 at 10:45 AM, Maik Riechert notifications@github.com
|
This is probably related to the change to re-setting the font-cache (#3077). |
According to the data model (https://docs.python.org/2/reference/datamodel.html#object.__hash__) objects that define __hash__ need to define __eq__ or __cmp__. By default, all user defined classes have a __cmp__ which evaluates to False for all other objects. Previously we do not define either __cmp__ or __eq__ on FontProperties, This results in never finding the property cached in the dict, hence the growth in the number of FontProperties (and I assume the stuff in them). By adding __eq__ and __ne__ we complete the data model and adding FontProperties to dictionaries should work as expected. This was not a problem before, but in matplotlib#3077 the caching key was changed from hash(prop) -> prop. Closes matplotlib#3264
According to the data model (https://docs.python.org/2/reference/datamodel.html#object.__hash__) objects that define __hash__ need to define __eq__ or __cmp__. By default, all user defined classes have a __cmp__ which evaluates to False for all other objects. Previously we do not define either __cmp__ or __eq__ on FontProperties, This results in never finding the property cached in the dict, hence the growth in the number of FontProperties (and I assume the stuff in them). By adding __eq__ and __ne__ we complete the data model and adding FontProperties to dictionaries should work as expected. This was not a problem before, but in matplotlib#3077 the caching key was changed from hash(prop) -> prop. Closes matplotlib#3264
According to the data model (https://docs.python.org/2/reference/datamodel.html#object.__hash__) objects that define __hash__ need to define __eq__ or __cmp__. By default, all user defined classes have a __cmp__ which evaluates to False for all other objects. Previously we do not define either __cmp__ or __eq__ on FontProperties, This results in never finding the property cached in the dict, hence the growth in the number of FontProperties (and I assume the stuff in them). By adding __eq__ and __ne__ we complete the data model and adding FontProperties to dictionaries should work as expected. This was not a problem before, but in matplotlib#3077 the caching key was changed from hash(prop) -> prop. Closes matplotlib#3264
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:
(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:
EDIT: I had measured object count growth for 1.3.1 also, and there was no growth of any class there.
The text was updated successfully, but these errors were encountered: