The game crashes when launching with the memory allocator debug mode enabled via -Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugAllocator=true in the JVM arguments, with
This started happening when the game switched to LWJGL 3.1.6 from 3.1.2 in 1.13-pre4, as a result of this change. 1.13-pre3 launches fine.
The affected code (which MCPConfig calls LWJGLMemoryUntracker) seems to be an ugly hack of some sort to manually mark allocations as ones that won't be explicitly freed since they last the entire time the game is running. It creates a MethodHandle that references DebugAllocator.untrack, and then stores that for later invocation if the DebugAllocator is in use. It uses invokeExact with that specific one, passing a single long parameter:
However, this infers a void return type. Some different possibilities for fixing it:
- Manually getting the return type, which requires long size = (long)handle.invokeExact(pointer) (the cast is required).
- Using invoke instead of invokeExact
- Using regular reflection instead of MethodHandle (this code doesn't need to be high-performance)