LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: urbies on May 04, 2021, 18:51:34

Title: First Fatal Error by runtime Environment
Post by: urbies on May 04, 2021, 18:51:34
Can anyone please tell me how to debug errors like this?

https://pastebin.com/yLug25B7
Title: Re: First Fatal Error by runtime Environment
Post by: jakethesnake on May 05, 2021, 11:04:52
This is where it happens:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 1249  org.lwjgl.system.JNI.invokePP(JJ)J (0 bytes) @ 0x000001fa58aada74 [0x000001fa58aada20+0x0000000000000054]
J 2179 c2 org.lwjgl.system.MemoryUtil.nmemAllocChecked(J)J (37 bytes) @ 0x000001fa58b5ee48 [0x000001fa58b5ee20+0x0000000000000028]
J 2057 c1 engine.graphics.Mesh.<init>([F[F[F[F[IZ)V (544 bytes) @ 0x000001fa51885984 [0x000001fa51882be0+0x0000000000002da4]
J 2174 c2 engine.entities.TextItemStatic.buildMesh()Lengine/graphics/Mesh; (581 bytes) @ 0x000001fa58b4cdd8

So it's most probably a memory allocation failure, meaning you're out of memory. Mind you, this is not java heap space, this is some other weird memory that lives outside the JVM that is used to communicate with drivers.

I've had similar bugs before, I got fatal errors. Here's my journey:
http://forum.lwjgl.org/index.php?topic=6922.msg36413#msg36413

So, this could be a memory leak, or insufficient memory. I think you roughly get the same amount of off heap space, as you get heap space, so setting a very large heap space might help.

If you turn on lwjgl debugging:

Configuration.DEBUG.set(debugAll);
Configuration.DEBUG_STREAM.set(System.out);
Configuration.DEBUG_MEMORY_ALLOCATOR.set(true);
Configuration.DEBUG_STACK.set(true);

You might be able to get something. What's great with that thing is that it will print un-released memory if you exit the application, so you can try and exit your game at certain points to make sure you clean everything up after you.
Title: Re: First Fatal Error by runtime Environment
Post by: urbies on May 09, 2021, 18:56:36
This ended up being a memory buffer that did not call MemoryUtil.memFree


Code: [Select]
            if (colourBuffer != null) {
                MemoryUtil.memFree(colourBuffer);
            }