Search code examples
javaopengl3dlwjgl

Where is this memory exception coming from?


I'm writing a 3D application in Java. I'm loading fields that contain around 65000 vertices each. These fields can translate, rotate etc. When a field scrolls out of the frustum it is culled, VBOs are cleared and the element arrays are stored in a memory buffer. I buffer a max of 5 of these fields. Any more than that they start going to file.

When I hit around 8 visible fields (520000) vertices the program crashes with system out of memory. I thought I was overloading the gpu memory but using GPU Shark I can see it only hits about 25%. My system has 8GB of RAM and looking via Task manager the memory usage barely registers. It sits at about 51%. So what am I running out of?

I use Concurrent Hashmaps to store my vertex data. I don't explicitly destroy/nullify them when not in use but that has never caused problems before.

I am using the OpenGL library via LWJGL.


Solution

  • If you are using eclipse, try to increase the eclipse heap size and then again try it out. JVM do not allow your whole RAM to the heap.

    How to increase application heap size in Eclipse?