Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Fix SplittingPool reclaim. #556

Merged
merged 1 commit into from
Jan 7, 2020
Merged

Fix SplittingPool reclaim. #556

merged 1 commit into from
Jan 7, 2020

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Jan 7, 2020

It should repopulate the pools from recently-freed blocks first.

As observed in #555.

It should repopulate the pools from recently-freed blocks first.
@@ -422,12 +422,19 @@ function free(ptr)
end

function reclaim(sz::Int=typemax(Int))
freed = 0
if !isempty(freed)
blocks = Set(freed)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because the same block might be twice in the freed list? Or did you just want a lightweight copy?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

freed might be modified concurrently (from a finalizer), so I just want a copy re.

if !isempty(freed)
# `freed` may be modified concurrently, so take a copy
blocks = Set(freed)
empty!(freed)
@pool_timeit "$phase.1a repopulate" repopulate(blocks)
@pool_timeit "$phase.1b compact" incremental_compact!(blocks)
end

I guess I decided back then to use a Set because incremental_compact! pops values, but that might have been a relic of past developments (I should probably go through the different uses of containers now that the code has stabilized a bit).

@maleadt maleadt merged commit 398e563 into master Jan 7, 2020
@bors bors bot deleted the tb/split_reclaim branch January 7, 2020 11:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants