Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 072e8f3 + fb07329 commit eb19435Copy full SHA for eb19435
lib/matplotlib/tests/test_constrainedlayout.py
@@ -1,3 +1,4 @@
1
+import gc
2
import numpy as np
3
import pytest
4
@@ -678,3 +679,16 @@ def test_constrained_toggle():
678
679
assert not fig.get_constrained_layout()
680
fig.set_constrained_layout(True)
681
assert fig.get_constrained_layout()
682
+
683
684
+def test_layout_leak():
685
+ # Make sure there aren't any cyclic references when using LayoutGrid
686
+ # GH #25853
687
+ fig = plt.figure(constrained_layout=True, figsize=(10, 10))
688
+ fig.add_subplot()
689
+ fig.draw_without_rendering()
690
+ plt.close("all")
691
+ del fig
692
+ gc.collect()
693
+ assert not any(isinstance(obj, mpl._layoutgrid.LayoutGrid)
694
+ for obj in gc.get_objects())
0 commit comments