Skip to content

BUG: Fix memory leak in Rolling.min and Rolling.max (#25893) #25926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.25.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ Groupby/Resample/Rolling
- Bug in :func:`pandas.core.groupby.GroupBy.agg` when applying a aggregation function to timezone aware data (:issue:`23683`)
- Bug in :func:`pandas.core.groupby.GroupBy.first` and :func:`pandas.core.groupby.GroupBy.last` where timezone information would be dropped (:issue:`21603`)
- Ensured that ordering of outputs in ``groupby`` aggregation functions is consistent across all versions of Python (:issue:`25692`)
- Bug in :meth:`pandas.core.window.Rolling.min` and :meth:`pandas.core.window.Rolling.max` that caused a memory leak (:issue:`25893`)


Reshaping
Expand Down
10 changes: 4 additions & 6 deletions pandas/_libs/window.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ cdef _roll_min_max(ndarray[numeric] values, int64_t win, int64_t minp,
ignoring NaNs.
"""
cdef:
ndarray[int64_t] starti, endi
int64_t[:] starti, endi
int64_t N
bint is_variable

Expand All @@ -1263,12 +1263,12 @@ cdef _roll_min_max(ndarray[numeric] values, int64_t win, int64_t minp,
return _roll_min_max_variable(values, starti, endi, N, win, minp,
is_max)
else:
return _roll_min_max_fixed(values, starti, endi, N, win, minp, is_max)
return _roll_min_max_fixed(values, N, win, minp, is_max)


cdef _roll_min_max_variable(ndarray[numeric] values,
ndarray[int64_t] starti,
ndarray[int64_t] endi,
const int64_t[:] starti,
const int64_t[:] endi,
int64_t N,
int64_t win,
int64_t minp,
Expand Down Expand Up @@ -1349,8 +1349,6 @@ cdef _roll_min_max_variable(ndarray[numeric] values,


cdef _roll_min_max_fixed(ndarray[numeric] values,
ndarray[int64_t] starti,
ndarray[int64_t] endi,
int64_t N,
int64_t win,
int64_t minp,
Expand Down