Deallocating Direct Buffer Native Memory in Java for JOGL

后端 未结 6 759
误落风尘
误落风尘 2020-11-30 04:19

I am using direct buffers (java.nio) to store vertex information for JOGL. These buffers are large, and they are replaced several times during the application life. The memo

6条回答
  •  佛祖请我去吃肉
    2020-11-30 05:04

    Direct buffers are tricky and don't have the usual garbage collection guarantees - see for more detail: http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#direct

    If you are having issues, I'd suggest allocating once and re-using the buffer rather than allocating and deallocating repeatedly.

提交回复
热议问题