Skip to content

Commit 4082b1c

Browse files
Backport PR pandas-dev#44032: [PERF] fixing memory leak in aggregation.pyx (pandas-dev#44055)
Co-authored-by: realead <[email protected]>
1 parent cf44b88 commit 4082b1c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

doc/source/whatsnew/v1.3.4.rst

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Bug fixes
3535
~~~~~~~~~
3636
- Fixed bug in :meth:`.GroupBy.mean` with datetimelike values including ``NaT`` values returning incorrect results (:issue:`43132`)
3737
- Fixed bug in :meth:`Series.aggregate` not passing the first ``args`` to the user supplied ``func`` in certain cases (:issue:`43357`)
38+
- Fixed memory leaks in :meth:`Series.rolling.quantile` and :meth:`Series.rolling.median` (:issue:`43339`)
3839

3940
.. ---------------------------------------------------------------------------
4041

pandas/_libs/window/aggregations.pyx

+2
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ def roll_median_c(const float64_t[:] values, ndarray[int64_t] start,
829829

830830
if not is_monotonic_increasing_bounds:
831831
nobs = 0
832+
skiplist_destroy(sl)
832833
sl = skiplist_init(<int>win)
833834

834835
skiplist_destroy(sl)
@@ -1064,6 +1065,7 @@ def roll_quantile(const float64_t[:] values, ndarray[int64_t] start,
10641065
if i == 0 or not is_monotonic_increasing_bounds:
10651066
if not is_monotonic_increasing_bounds:
10661067
nobs = 0
1068+
skiplist_destroy(skiplist)
10671069
skiplist = skiplist_init(<int>win)
10681070

10691071
# setup

0 commit comments

Comments
 (0)