On Thu, 14 Nov 2024 17:26:31 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
> > That is probably correct. I was however thinking that it would only be > > pooled asymmetrically as some type of hystereses. So you pool when you > > remove a node (switch the head) and keep it far an arbitrary amount of > > removals. So it would only really waste memory for cleaners that have this > > behaviour that they keep adding and removing cleanable around a > > NODE_CAPACITY boundary. > > I have been playing with > [8343704-node-cache.txt](https://github.com/user-attachments/files/17753986/8343704-node-cache.txt) > -- is that what you had in mind? Yes. It amortises the allocation over at least NODE_CAPACITY inserts, instead of 1 in the worst case. I have very little experience how this plays out in practice, nor how the cleanable are used. This was purely an observation based on seen a symmetrical grow/shrink behaviour of some resource. ------------- PR Comment: https://git.openjdk.org/jdk/pull/22043#issuecomment-2478136490