<div dir="ltr">Hi,<div><br></div><div>I noticed that the method Arena::addCloseAction has been dropped from the API. May I ask in that case what is the way to create a custom allocator that manages its allocated memory? With the method, I believe it can be achieved with something like this:</div><div><br></div><div>public MemorySegment allocate(long byteSize, long byteAlignment) {</div><div>    if (byteAlignment > MAX_ALIGNMENT) {</div><div>        throw new IllegalArgumentException();</div><div>    }</div><div><br></div><div>    try {</div><div>        var arena = Arena.ofAuto();</div><div>        long address = (long)MALLOC.invokeExact(byteSize); // I assume this should work since other reinterpret casts like unsigned <-> int is legal here</div><div>        arena.addCloseAction(() -> {</div><div>                try {</div><div>                    FREE.invokeExact(address);</div><div>                } catch(Throwable e) {</div><div>                    throw new RuntimeException(e);</div><div>                }</div><div>        });</div><div>        return MemorySegment.ofAddress(address, byteSize, arena);</div><div>    } catch(Throwable e) {</div><div>        throw new RuntimeException(e);</div><div>    }</div><div>}</div><div><br></div><div>Thanks a lot,</div><div>Quan Anh</div><div>    </div></div>