OutOfMemoryError: Direct buffer memory

Hi, i’ve made:


         m_vertices = BufferUtil.newFloatBuffer(m_vertexCount * 3* fVertexPerPixel);		
        m_texCoords = BufferUtil.newFloatBuffer(m_vertexCount * 2* fVertexPerPixel);
        // float [] vertices= new float[m_vertexCount * 2* fVertexPerPixel*fVertexPerPixel];

and i get the memory error.
if i enable “float [] vertices= new float[m_vertexCount * 2* fVertexPerPixelfVertexPerPixel];"
and disable "m_vertices = BufferUtil.newFloatBuffer(m_vertexCount * 3
fVertexPerPixel);”, i dont get an error.

  1. is the ByteBuffer limited in any way, and have less mem space than the java heap?
  2. can i extend the java heap?

1: are you in the right forum?
2: presuming you are, can it be a bug in the lib?
3: presuming 1 is true and 2 is false, then it could be your device is out of memory.

Direct buffer memory lives outside of the Java heap and has a different parameter affecting the maximum amount the JVM will allocate. This is set with the -XX:MaxDirectMemorySize=xxxM switch for Sun’s JVMs - the default setting is 64M.

Cas :slight_smile: