3 ms·
Nope, the wrapper is, but a ByteBuffer also allows different allocation strategies, which is how different libraries use them. For example, LWJGL3 has a separa
by kuschku 9y ago
Nope, the wrapper is, but a ByteBuffer also allows different allocation strategies, which is how different libraries use them.
For example, LWJGL3 has a separate stack where it allocates them.
- pharrington 9y agoThere is no way to use stack allocated memory in Java. LWJGL's MemoryStack emulates a C style stack by preallocating a set amount of off-JVM-heap memory and decrementing/incrementing an index into it.
- pjmlp 9y ago> There is no way to use stack allocated memory in Java. Not directly, but most JIT compilers do it. It is tricky and fragile, but one can make use of the JIT logs and try to re-write the code so that it takes the right decision regarding escape analysis. As for an actual support at language level, we need to wait for the outcome of projects Valhalla and Panama.
- kuschku 9y ago> LWJGL's MemoryStack emulates a C style stack by preallocating a set amount of off-JVM-heap memory and decrementing/incrementing an index into it. So do all relevant game engines. Having a separate memorystack from the actual one for game objects is basically standard.