Deallocating Direct Buffer Native Memory in Java for JOGL

后端 未结 6 749
误落风尘
误落风尘 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 04:48

    Deallocating a Direct Buffer is a job done by the garbage collector some time after the ByteBuffer object is marked.

    You could try calling the gc immediatly after deleting the last reference to your buffer. At least there's a chance that the memory will be free'd a bit faster.

提交回复
热议问题