6 ms·
java.lang.foreign.Arena
by kernal 9mo ago
java.lang.foreign.Arena
- riku_iki 9mo agoMy understanding is that that arena allows you to allocate memory segments, but you can't do much with it, you can't allocate var or object on it like in C++ for example, so its almost useless.
- kernal 9mo agohttps://docs.oracle.com/en/java/javase/21/core/memory-segments-and-arenas.html#GUID-01CE34E8-7BCB-4540-92C4-E127C1F62711 https://docs.oracle.com/en/java/javase/21/core/memory-segmen...
- riku_iki 9mo agoThat Arena is not integrated into language. You can't do something like: var myObj = new(my_arena) MyClass();
- pjmlp 9mo agoYou certainly can, as they were designed as JNI replacement, with the goal to fully support the C ABI of the host platform. You can either do the whole boilerplate manually with Panama set of APIs, or write a C header file and let jextract do the work of boilerplate generation.
- riku_iki 9mo ago> You certainly can I am wondering if there is working code example, or this is just speculation?