HemaNage / gstreamer-java

Automatically exported from code.google.com/p/gstreamer-java
1 stars 0 forks source link

Memory Leak using org.gstreamer.swing.VideoComponent #142

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
OS: Windows 7 64, 32-bit jdk/jre7
Gstreamer-Java: Trunk

I might be running an atypical application, however it seems my Java 
Application eventually runs out of memory after about a dozen runs.

This current application calls for simultaneous videos, and the ability to 
choose different videos. I am then adding and removing the VideoComponents as 
needed from my JPanels.

Using jvisualvm it seems that there are listeners preventing the GC from 
cleaning up the classes.

Albeit not pretty, to obtain a clean bill of health I had to add a method to 
clean up these things.

public void destroy() {
        renderComponent.removePropertyChangeListener(propListener);
        renderComponent.removeMouseListener(mouseListener);
        renderComponent.removeMouseMotionListener(mouseListener);
        renderComponent.removeKeyListener(keyListener);
        removeKeyListener(keyListener);
        removeComponentListener(componentAdapter);
        remove(renderComponent);
        resourceTimer.removeActionListener(resourceReaper);
        resourceTimer.stop();
        videosink.removeListener();
    }

Attached is a TestCase that shows my issue as well as the patch. 

Also looking at a similar thread 
(https://groups.google.com/d/topic/gstreamer-java/j207a4GpZa8/discussion) I am 
trying to investigate if we should disconnect listeners before disposing the 
objects.

Thanks,
Michael Esemplare

Original issue reported on code.google.com by Michael....@gmail.com on 17 Jun 2014 at 5:36

Attachments: