File tree Expand file tree Collapse file tree 5 files changed +408
-320
lines changed Expand file tree Collapse file tree 5 files changed +408
-320
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ Bug Fixes
96
96
- Bug in ``scatter_matrix`` draws unexpected axis ticklabels (:issue:`5662`)
97
97
98
98
- Fixed bug in ``StataWriter`` resulting in changes to input ``DataFrame`` upon save (:issue:`9795`).
99
+ - Bug in time-series plot causes memory leak (:issue:`9003`)
99
100
100
101
101
102
- Bug in ``transform`` causing length mismatch when null entries were present and a fast aggregator was being used (:issue:`9697`)
Original file line number Diff line number Diff line change @@ -3366,6 +3366,35 @@ def test_sharey_and_ax(self):
3366
3366
self .assertTrue (ax .yaxis .get_label ().get_visible (),
3367
3367
"y label is invisible but shouldn't" )
3368
3368
3369
+ def test_memory_leak (self ):
3370
+ """ Check that every plot type gets properly collected. """
3371
+ import weakref
3372
+ import gc
3373
+
3374
+ results = {}
3375
+ for kind in plotting ._plot_klass .keys ():
3376
+ args = {}
3377
+ if kind in ['hexbin' , 'scatter' , 'pie' ]:
3378
+ df = self .hexbin_df
3379
+ args = {'x' : 'A' , 'y' : 'B' }
3380
+ elif kind == 'area' :
3381
+ df = self .tdf .abs ()
3382
+ else :
3383
+ df = self .tdf
3384
+
3385
+ # Use a weakref so we can see if the object gets collected without
3386
+ # also preventing it from being collected
3387
+ results [kind ] = weakref .proxy (df .plot (kind = kind , ** args ))
3388
+
3389
+ # have matplotlib delete all the figures
3390
+ tm .close ()
3391
+ # force a garbage collection
3392
+ gc .collect ()
3393
+ for key in results :
3394
+ # check that every plot was collected
3395
+ with tm .assertRaises (ReferenceError ):
3396
+ # need to actually access something to get an error
3397
+ results [key ].lines
3369
3398
3370
3399
3371
3400
@tm .mplskip
You can’t perform that action at this time.
0 commit comments