RFR: 8333886: Explicitly specify that asSlice and reinterpret return a memory segment backed by the same region of memory.
Brandon Kolesar
duke at openjdk.org
Tue Jun 11 08:27:20 UTC 2024
On Mon, 10 Jun 2024 17:11:17 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> > The term 'subset' doesn't feel right to me here, since we're only talking about a single memory region (not a set of memory region**s**). I suggest 'sub-region' instead.
>
> Actually, nvm, that doesn't work for `reinterpret` since the returned segment can also cover a larger region of memory.
In my opinion, any 'sub' terminology is misleading since, as you pointed out, one can (and often will) `reinterpret` to a *larger* size. Wouldn't something like, "The returned memory segment is backed by the same region of memory that backs this memory segment", be sufficiently accurate? Could even append, "No memory will be allocated or deallocated", to really hammer the point home.
Using 'subset' for `asSlice` makes sense. Though possibly unnecessary.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19633#issuecomment-2160083878
More information about the core-libs-dev
mailing list