Re: glDeleteBuffers Very Inconvenient.
Posted by
Sven Gothel on
Jan 23, 2013; 12:11am
URL: https://forum.jogamp.org/glDeleteBuffers-Very-Inconvenient-tp4027988p4027990.html
On 01/23/2013 12:11 AM, millerni456 [via jogamp] wrote:
> Hey all,
>
> I found an interesting article regarding Java's garbage collection.
>
> It said this: "A finalizer in Java is the opposite of a constructor. While a
> constructor method performs initialization for an object, a finalizer method
> performs finalization for the object. Garbage collection automatically frees
> up the memory resources used by objects, but objects can hold other kinds of
> resources, such as open files and network connections. The garbage collector
> cannot free these resources for you, so you need to write a finalizer method
> for any object that needs to perform such tasks as closing files, terminating
> network connections, deleting temporary files, and so on."
>
> *URL:
http://docstore.mik.ua/orelly/java-ent/jnut/ch03_03.htm*>
The finalize method is not guaranteed to be called
and you have no control when it is called.
Hence utilizing this 'hook' to implement a controlled lifecycle for
an object is not at all suitable, hence we use an explicit 'destroy' method
(or similar naming) in our API(s).
> So I wonder if grabbing an instance in the finalize method would create a
> performance drop as I had worried about earlier.
> If it does, at least I can still do what I did in my last game in a more
> abstract way!
I don't know how this is related .. will read your prev. post.
~Sven