-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fixes issue #2556 #2558
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
fixes issue #2556 #2558
Conversation
Fixes it in two ways: 1) changes the closure of `on_dpi` to be over a weakref, not `self` 2) cleans up the call back when the quiver is removed
Unclear why pep8 failed on 2.x, but passed on 3.x |
@efiring Can you take a look at this? The travis failures are unrelated ( |
@tacaswell, It looks like QuiverKey also needs this treatment. Is this correct? |
I believe so. |
I haven't tested the actual changeset, but it looks like it would do the job. I'm not positive that both the weak reference and the callback cleanup are needed--are there circumstances when the latter would not be sufficient? |
If the user does not call Unless the weakref is actively harmful, I think both should be used. |
@tacaswell Do you want to go ahead and apply the same treatment to QuiverKey before this is merged? |
If this looks good to you, then yes. |
@tacaswell It does look OK to me. @mdboom, do you want to check it? You have much more experience with weakref sorts of things than I do. It would be nice to get this finished. |
renamed imported matplotlib.collections from `collections` -> `mcollections` to try and avoid clashing with `collections` in python core.
tests memory leaks reported in issue matplotlib#2556
@@ -850,7 +888,7 @@ def __init__(self, ax, *args, **kw): | |||
|
|||
#Make a collection | |||
barb_size = self._length ** 2 / 4 # Empirically determined | |||
collections.PolyCollection.__init__(self, [], (barb_size,), offsets=xy, | |||
mcollections.PolyCollection.__init__(self, [], (barb_size,), offsets=xy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long now... (80 chars apparently)
Fixes it in two ways:
on_dpi
to be over a weakref, notself
This should be a reasonable test:
This SO question was helpful: http://stackoverflow.com/questions/10874499/understanding-reference-count-of-class-variable