HowTo fix: java.lang.OutOfMemoryError: Direct buffer memory

I get this error when running my game:

java.lang.OutOfMemoryError: Direct buffer memory

It gives this error when In add two textures to a Material.
One DiffuseMap texture and one NormalMap texture.
Then I add this material to a spatial.
When I start the game I get: java.lang.OutOfMemoryError: Direct buffer memory

Does someone know how I can fix this error?

1 Like

Please remember that if you need help you need to:

  • Show Code
  • Show StackTrace
  • Not presume your code “just does x” or “works”.

How big are your textures?

Based on the information provided, the only advice we can give is:

  • increase RAM settings
  • use smaller textures

But since we don’t know what the scene was like before you added those two textures, it’s hard to say. Maybe it was just the straw that broke the camel’s back?

For reference: https://www.mikeash.com/getting_answers.html

1 Like

@DoSt you must be having a shape or spatial of high details or smoothing so you got out of your heap memory you may have a null message coming out of messages area of scene composer …try to load a low detailed object then add the material for it , if it loads then the error from your spatial of high details