Who recovers the memory?

who releases opengl buffers?

Search Google for: who releases opengl buffers?

Search Android Developers Group for: who releases opengl buffers?

Search Android Beginers Group for: who releases opengl buffers?

Search Google Code for: who releases opengl buffers?

Search Android Issues Database for: who releases opengl buffers?

A nice topic on glbegin and glend

In addition, glBegin()/glEnd() style code creates a lot of function call overhead because you call a separate function for every vertex, color, texture coordinate, and normal. This overhead is non-trivial for objects with a lot of data.

VBOs: vertex buffer objects. These are introduced in opengl 1.5

release opengl memory in android

Search Google for: release opengl memory in android

Search Android Developers Group for: release opengl memory in android

Search Android Beginers Group for: release opengl memory in android

Search Google Code for: release opengl memory in android

Search Android Issues Database for: release opengl memory in android

Read this thread

Search for: who frees cleanup allocate memory opengl buffers?

java nio bytebuffer

Search Google for: java nio bytebuffer

Search Android Developers Group for: java nio bytebuffer

Search Android Beginers Group for: java nio bytebuffer

Search Google Code for: java nio bytebuffer

Search Android Issues Database for: java nio bytebuffer

Looks like nio can take care of garbage collection. read this

Search for: what are java nio direct buffers

read a little bit about direct buffers here

An interesting read about JVM memmory management: pdf file

Another nice article from ibm on memory management

The java.nio package is there to allocate memory space outside of the java heap that can be directly used by such systems as OpenGL or file i/o etc.

One question arises when the "allocateDirect" method is called to allocate memory for a native buffer. who is going to clean up this native allocation? Should I call some kind of a "deallocate"? There is no such function.

This is because, the nio buffers are actually java objects that eventually point to the native buffer. These objects are garbage collected. When they are garbage collected they go ahead and delete the native memory. Java programs doesn't have to do anything special to unallocate or free the memory.

However the "gc" won't get fired unless there is memory needed in the java heap. This means you can run out of native memory and gc may not realize it.

One implementation in the references above points to an approach where an outof memory exception will trigger a "gc" and tries it again.

Importantly for the sake of OpenGL under ordinary circumstances one can allocate the native buffers and not worry about releasing explicitly as that is done by the gc.