Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3882397

Browse files
committed
FIX: squash memory leak for redraws
1 parent9f74ea7 commit3882397

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎lib/matplotlib/transforms.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ def set_children(self, *children):
169169
# parents are destroyed, references from the children won't
170170
# keep them alive.
171171
forchildinchildren:
172-
child._parents[id(self)]=weakref.ref(self)
172+
# pass a wek reference. The second arg is a callback for
173+
# when the weak ref is garbage collected, and will also
174+
# remove the dictionary element, otherwise child._parents
175+
# keeps growing for multiple draws.
176+
ref=weakref.ref(self,lambdaref,sid=id(self),
177+
target=child._parents:target.pop(sid))
178+
child._parents[id(self)]=ref
173179

174180
ifDEBUG:
175181
_set_children=set_children

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp