fix memory leak on incor calc of cleanup bucket#429
Conversation
0507668 to
4b34a22
Compare
|
@flymedllva Thank you for the PR. The ci passes. is it possible to write a test for the issue? |
cleanup does not try to clean empty bucket
c61ba03 to
89d19c9
Compare
|
I couldn't find a direct test for cleanup, so I made one and included in its implementation a sub-check that caused the slice to grow uncontrollably without allowing cleanup to terminate. With the fix, this test passes. |
89d19c9 to
dc92bd6
Compare
|
The test seems to fail: |
|
Apparently CI runners have fewer CPUs and because of this the tests take longer than on my computer. To fix this I had to introduce a cleanedBucketsCount variable in cleanup return, which I can use in the test to count the buckets cleaned by cleanup. The test is no longer CPU-dependent and takes less time to run + it catches this case immediately during the first cleanup without reaching the test case with system time change (although it works too). |
|
Thank you for updating the PR. The linter is not happy now: |
ccc15e4 to
daf48d2
Compare
|
Thank you so much for the quick fix and addressing all the issues. Appreciate it. |
cleanup now does not try to clean an empty bucket selected by the cleanup algorithm
this fixes a critical problem of slice growth when the algorithm incorrectly calculates the buckets that need to be cleared, let's say this behavior occurs at the time change described in issue: #426
this problem appeared after improving cleanup in this pr: #358
most likely the algorithm for calculating the cleaning bins also needs to be revised, but for me now it is important to fix the increase in memory consumption when changing the system time