Skip to content

Commit

Permalink
Backport PR pandas-dev#44032: [PERF] fixing memory leak in aggregatio…
Browse files Browse the repository at this point in the history
…n.pyx (pandas-dev#44055)

Co-authored-by: realead <[email protected]>
  • Loading branch information
meeseeksmachine and realead authored Oct 16, 2021
1 parent cf44b88 commit 4082b1c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.3.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Bug fixes
~~~~~~~~~
- Fixed bug in :meth:`.GroupBy.mean` with datetimelike values including ``NaT`` values returning incorrect results (:issue:`43132`)
- Fixed bug in :meth:`Series.aggregate` not passing the first ``args`` to the user supplied ``func`` in certain cases (:issue:`43357`)
- Fixed memory leaks in :meth:`Series.rolling.quantile` and :meth:`Series.rolling.median` (:issue:`43339`)

.. ---------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions pandas/_libs/window/aggregations.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ def roll_median_c(const float64_t[:] values, ndarray[int64_t] start,

if not is_monotonic_increasing_bounds:
nobs = 0
skiplist_destroy(sl)
sl = skiplist_init(<int>win)

skiplist_destroy(sl)
Expand Down Expand Up @@ -1064,6 +1065,7 @@ def roll_quantile(const float64_t[:] values, ndarray[int64_t] start,
if i == 0 or not is_monotonic_increasing_bounds:
if not is_monotonic_increasing_bounds:
nobs = 0
skiplist_destroy(skiplist)
skiplist = skiplist_init(<int>win)

# setup
Expand Down

0 comments on commit 4082b1c

Please sign in to comment.