On Thu, 31 Oct 2024 14:32:46 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> This PR proposes to add a small text segment on the >> `MemorySegment::reinterpret` overloads that takes an Arena stating the >> responsibility of actually freeing reinterpreted segments lies with the >> *original* arena. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Improve docs src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 772: > 770: * <li>The reinterpreted segment can be accessed <em>after</em> > its region > 771: * of memory has been deallocated via the original arena > (use after free).</li> > 772: * <li>The reinterpreted segment's region of memory will > <em>not</em> be On a second look, perhaps this second assertion doesn't add much. Perhaps we can rewrite more succinctly as: This might lead to *use after free*, as the returned segment can be accessed <em>after</em> its region of memory has been deallocated via this segment's arena. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21761#discussion_r1824888310