Does a PhantomReference being in a ReferenceQueue stop the PhantomReference from being GC'd?
<p>I'm using the LWJGL libraries and unfortunately I need to free up texture/vbo buffers myself whenever a node in my scene graph needs to die, I can't even use finalize() method to do this as I can't guarantee that it will be executed in the same thread the opengl libs expects it to.</p>

<p>So I'm using PhantomReferences. In my scene graph nodes I've put this in the constructor:</p>

<pre><code>phantomReference = new ScenePhantomReference(this, Game.phantomReferenceQueue);
Game.phantomReferenceList.add(phantomReference);
</code></pre>

<p>As you can see in the second line I've added the phantomReference to a list in the main class. My logic is that when the node becomes dereferenced the phantomReference won't get garbage collected with it as there's still a reference in the main class.</p>

<p>Is adding it to a list like this needed? Or will it be spared from the GC (maybe the Game.phantomReferenceQueue keeps a reference to it?).</p>

<p>This one is a pain to test, I could just remove the list but the GC could just be processing the object that's being watched before the phantomReference and make it look like the list is redundant, when it really isn't. I'd be paranoid that any different VM implementation or version might decide to do it the other way round.</p>
