On Wed, 30 Oct 2024 12:42:16 GMT, Jorn Vernee <jver...@openjdk.org> wrote:

> I think it's technically correct, but I think it's starting off on the wrong 
> foot. There's no transfer of ownership happening, `reinterpret` just returns 
> a view of the old memory region with a new scope borrowed from the given 
> arena. I think there is a conceptual difference between a segment allocated 
> by a given arena, and one reinterpreted with a given arena, even if they act 
> very similar. I think calling that concept by another name will help people's 
> understanding.

I'm not too sure such a different exist. As a client of the segments there's 
literally no way to tell them apart. I still feel there's two concerns here - 
e.g. (a) how do I use a reinterpreted segment and, (b) as the creator of the 
reinterpreted segment, what should I look out for. The answer to (a) is, 
really, "like any other segment allocated by the provided arena".

Perhaps we can clarify by saying:

"In other words, this method returns a segment that can be used as any other 
segment allocated using the provided arena."

But then, somewhere else say:

"The returned segment is backed by the same memory region as that of the 
original segment. As such, the region of memory backing the returned segment is 
truly deallocated only when the original segment's arena is closed."

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21761#discussion_r1822572067

Reply via email to