Bug 1312 - GLContextShareSet memory leak when repeatedly creating and removing GLDrawables
Summary: GLContextShareSet memory leak when repeatedly creating and removing GLDrawables
Status: UNCONFIRMED
Alias: None
Product: Jogl
Classification: JogAmp
Component: opengl (show other bugs)
Version: 2.4.0
Hardware: All all
: P4 normal
Assignee: Julien Gouesse
URL:
Depends on:
Blocks:
 
Reported: 2016-06-09 09:13 CEST by Tom Nuydens
Modified: 2017-01-17 11:21 CET (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Nuydens 2016-06-09 09:13:35 CEST
My use case is an application that has one "main" GLDrawable which is always visible, and one or more "secondary" GLDrawables that can be opened and closed any number of times (e.g. in a separate window). I want all these drawables to do GL context sharing.

As long as the main drawable exists, however, GLContextShareSet seems to keep strong references to all the secondary ones that I have ever created. Hence, even though they have been destroyed, the secondary ones cannot be GC'ed. I couldn't see a good reason for this, and was able to work around it by replacing the maps in GLContextShareSet with "weak key" maps.
Comment 1 Tom Nuydens 2016-06-13 11:36:40 CEST
I submitted my workaround in a pull request:
https://github.com/sgothel/jogl/pull/101
Comment 2 Julien Gouesse 2016-07-06 09:01:46 CEST
Hi

I agree with your main statement, GLContextShareSet shouldn't keep strong references on objects that could become useless, it shouldn't prevent their garbage collection. I just wonder if there is a more simple solution to fix this bug. I have looked at your pull request.