Conversation
5ad1005 to
f7e897a
Compare
src/backend/decayrange.h
Outdated
|
|
||
| namespace snmalloc | ||
| { | ||
| template<typename Rep> |
There was a problem hiding this comment.
Given the reuse of the large buddy range rep here, at least a comment (or a concept) might be in order.
src/backend/decayrange.h
Outdated
| } | ||
|
|
||
| // We have run out of memory. | ||
| handle_decay_tick(); // Try to free some memory. |
There was a problem hiding this comment.
Does this need to be interlocked against the timer firing? I suppose not due to the prepend-only nature of all_local, the read-only nature of the spine traversal, and the use of pop_all for each found sizeclass... assuming that the parent range doesn't need interlocking, which, by default anyway, it doesn't (specifically, the parent will be a CommitRange whose parent is a GlobalRange by default, and CommitRange doesn't actually have state and GlobalRange is an interlock).
The presumption of concurrency-safeness of parent might merit being written down somewhere?
There was a problem hiding this comment.
Yeah, I plan to add a static constexpr to all the types that is the concurrency safe property like currently happens with Align. I just hadn't threaded it through yet. So GlobalRange would be true, CommitRange would be whatever the parent says, and the buddy would be false.
f6254d6 to
93d6e3f
Compare
|
So the perf of this is okay, but it increases memory footprint for some examples too much. I have factored out the primary changes to enable this into #491, so that can be landed, and the perf of this can be fixed and landed at a later point. |
37a1ce8 to
9694c96
Compare
|
This paper has a really interesting approach to work stealing of chunks between threads: I think we could use some of the ideas in this paper, to make the decay range perform better. |
Implemenation of a range that gradually releases memory back to
the OS. It quickly pulls memory, but the dealloc_range locally caches
the memory and uses Pal timers to release it back to the next level
range when sufficient time has passed.