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

Appearance settings

Commit 34d7183

Browse filesBrowse files
committed
Run garbage collection in leak test
Without it, checking the 'external' memory may indicate a leak even if we've gotten rid of all our objects.
1 parent 44b55df commit 34d7183
Copy full SHA for 34d7183

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎lib/matplotlib/tests/test_backends_interactive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backends_interactive.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ def test_blitting_events(env):
508508
# The source of this function gets extracted and run in another process, so it
509509
# must be fully self-contained.
510510
def _test_figure_leak():
511+
import gc
511512
import sys
512513

513514
import psutil
@@ -523,12 +524,14 @@ def _test_figure_leak():
523524
plt.pause(t)
524525
plt.close(fig)
525526
mem = p.memory_info().rss
527+
gc.collect()
526528

527529
for _ in range(5):
528530
fig = plt.figure()
529531
if t:
530532
plt.pause(t)
531533
plt.close(fig)
534+
gc.collect()
532535
growth = p.memory_info().rss - mem
533536

534537
print(growth)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.