wjc272008 / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

Make NativeObject.deleteObject() delete native buffers #448

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Dynamically generate a large number of textures or meshes at run-time

What is the expected output? What do you see instead?
The objects should be collected automatically by the garbage collector, instead 
the exception "java.lang.OutOfMemoryError: Direct buffer memory" is raised.

As a proposed fix, the deleteObject() method in NativeObject class should 
support two additional requirements:
1) Allow this method to be called directly by the user, so that even if the 
NativeObjectManager attempts to garbage collect this object, it should still 
work normally. This means handling double delete in OpenGL in the 
Renderer.delete***() methods
2) The method should call BufferUtils.destroyByteBuffer() on all ByteBuffers 
owned by the NativeObject

Original issue reported on code.google.com by ShadowIs...@gmail.com on 5 Jan 2012 at 8:04