Skip to content

Commit 0638f7f

Browse files
authored
[PERF] fixing memory leak in aggregation.pyx (#44032)
1 parent bf09391 commit 0638f7f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

doc/source/whatsnew/v1.3.4.rst

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ def roll_median_c(const float64_t[:] values, ndarray[int64_t] start,
835835

836836
if not is_monotonic_increasing_bounds:
837837
nobs = 0
838+
skiplist_destroy(sl)
838839
sl = skiplist_init(<int>win)
839840

840841
skiplist_destroy(sl)
@@ -1070,6 +1071,7 @@ def roll_quantile(const float64_t[:] values, ndarray[int64_t] start,
10701071
if i == 0 or not is_monotonic_increasing_bounds:
10711072
if not is_monotonic_increasing_bounds:
10721073
nobs = 0
1074+
skiplist_destroy(skiplist)
10731075
skiplist = skiplist_init(<int>win)
10741076

10751077
# setup

0 commit comments

Comments
 (0)