On Mon, 13 Jul 2026 00:52:29 GMT, David Holmes <[email protected]> wrote:

> Sorry Serguei I thought I could help out here but I don't understand the code 
> enough. I don't quite understand how the counts are used. The tagcount seems 
> to increase forever and is used to size the array by setting the max-count to 
> its current value - but when does this happen and how-often? The objCount is 
> the next index into the array IIUC but it can be reduced when an object is 
> freed. Seems to me the array could potentially be much larger than the 
> maximum index actually used.

Thanks David. I agree with you, it is still over complicated. I've decided to 
get rid of the `objectCount` variable.
Then the `ObjectFree` events and the related capability are not needed anymore. 
It became simpler now.
The `objectCount` and the `ObjectFree` callback have been removed.  The 
`objectTagCount` is used as next array index. Tags are assigned monotonically 
and the second pass indexes the arrays by `tag - 1`.
The `objectCountMax` is set once to the current `objectTagCount` before 
allocating the arrays and after the first iteration and forced GC.  So the 
arrays can be larger than the current live object count.
Sorry for making this pretty intrusive cleanup but this simplification worth it.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/31585#issuecomment-4966458932

Reply via email to