From 901a2f0107781b2ee674b1b27fd159b94cb6083b Mon Sep 17 00:00:00 2001 From: Fabian Schlieper Date: Wed, 18 Jul 2018 11:48:06 +0200 Subject: [PATCH 1/2] Fix memory leak in roll_quantile --- pandas/_libs/window.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/_libs/window.pyx b/pandas/_libs/window.pyx index 9e704a9bd8d3f..cea77e2c88b1b 100644 --- a/pandas/_libs/window.pyx +++ b/pandas/_libs/window.pyx @@ -1481,6 +1481,8 @@ def roll_quantile(ndarray[float64_t, cast=True] input, int64_t win, else: output[i] = NaN + skiplist_destroy(skiplist) + return output From 4743642210ce2ccc692b5e2d204a7ee897075b57 Mon Sep 17 00:00:00 2001 From: Fabian Schlieper Date: Wed, 18 Jul 2018 11:48:06 +0200 Subject: [PATCH 2/2] Fix memory leak in roll_quantile --- doc/source/whatsnew/v0.23.4.txt | 1 + pandas/_libs/window.pyx | 2 ++ 2 files changed, 3 insertions(+) diff --git a/doc/source/whatsnew/v0.23.4.txt b/doc/source/whatsnew/v0.23.4.txt index ac1ef78fd6fd2..6d98334ace9e2 100644 --- a/doc/source/whatsnew/v0.23.4.txt +++ b/doc/source/whatsnew/v0.23.4.txt @@ -31,6 +31,7 @@ Bug Fixes **Groupby/Resample/Rolling** - Bug where calling :func:`DataFrameGroupBy.agg` with a list of functions including ``ohlc`` as the non-initial element would raise a ``ValueError`` (:issue:`21716`) +- Bug in ``roll_quantile`` caused a memory leak when calling ``.rolling(...).quantile(q)`` with ``q`` in (0,1) (:issue:`21965`) - **Conversion** diff --git a/pandas/_libs/window.pyx b/pandas/_libs/window.pyx index 9e704a9bd8d3f..cea77e2c88b1b 100644 --- a/pandas/_libs/window.pyx +++ b/pandas/_libs/window.pyx @@ -1481,6 +1481,8 @@ def roll_quantile(ndarray[float64_t, cast=True] input, int64_t win, else: output[i] = NaN + skiplist_destroy(skiplist) + return output