OutOfMemoryError: Direct buffer memory with certain models

Hi,

i´m getting java.lang.OutOfMemoryError: Direct buffer memory when i use certain models in my scene.
At the main menue is a flycam and the scene is loaded. However this error just occures when i start a game at the Lobby
wich creates a PlayerAppState.
The models doesn´t have many polygons(for example one is a single hut) and the texture is in a 2500x1875 res.
It´s definately no problem of my memory since over 4gb are always free.

I recently tried a 1600x1200 texture and it worked perfectly fine, any suggestions why this happens?
It shouldn´t be a problem of limits if i´m right.

thanks in advance for any help

Try icreasing the direct memory available for the jvm via an jvm argument. See the documentation of your jvm for details on the syntax.

I´ve increased it to 8192m and it still occures. I just have to edit the config file, right?

I’m not familiar with how the sdk does this. But I would guess that in the wiki on this page there is something about, as this is a quite common problem.

Is this in the SDK scene viewer or in your app?

If you increase the direct memory in the SDK note that if you set a value that is too large it will just be ignored and you are right back at the (very low) default. So for example, the SDK default on 32 bit OS’s is completely ignored because by default it is set to 2 gig and in Java on a 32 bit OS the heap or direct mem can only be set to 1 gig.

The problem only occures when i start the app, in the SDK it works.

I use a 64 Bit OS and i also tried it with 4096 but it didn´t work either.

sorry for the late reply

Uh… then what config file are you editing?

The CONF- file at: C:\Program Files\jmonkeyplatform\etc

I guess you need to set the runtime JVM arguments in the run configuration of the project.
Like this: http://netbeanside61.blogspot.se/2009/02/using-command-line-arguments-in.html

@ChriFe said: The CONF- file at: C:Program Filesjmonkeyplatformetc

As jmaasing said, because the file you are editing is for the SDK itself… and has nothing to do with the running of your apps.

Ok thanks for the help :slight_smile:

But what exactly do i have to put in there?
How is the argument written?

-XX:MaxDirectMemorySize=1024M

It took almost 2 seconds to find it on google, you should try it sometime :wink:

1 Like