GLDrawableHelper hanging on to references?
Posted by PJDM on Jun 23, 2014; 12:04pm
URL: https://forum.jogamp.org/GLDrawableHelper-hanging-on-to-references-tp4032475.html
JOGL 2.1.5
We have an application that allows users to open and close multiple windows, each with its own GLCanvas. A shared drawable is used to share textures.
We've noticed that when windows are closed, memory usage doesn't go down as much as we expect. Profiling shows that GLCanvas objects are hanging around. Some investigation shows that GLDrawableHelper has a ThreadLocal<Runnable> perThreadInitAction that has Runnables added to it, but seemingly never removed. Since these are GLCanvas init actions, GLCanvas instances are being indirectly referenced from perThreadInitAction, so the GLCanvas instances can't be garbage collected.
Also, GLContextShareSet.registerSharing() adds references between contexts, but again seemingly the references aren't removed when a context is disposed.
As far as we can tell, we're calling dispose() in the right places, but of course we might be missing some. Our application is fairly large, so a reproducer could be time consuming. Before we start, does anyone have any ideas about where we might look?
Thanks.
PJDM