#23 memory leak in 0.9 - delete() upon destruction of GSMovie

closed-fixed
nobody
None
5
2011-10-02
2011-06-13
Anonymous
No

Hi,
The following code leads to an out of memory error (cannont malloc) after a few minutes :

void draw() {
image(m, 0, 0);
if (! m.isPlaying()) {
//m.delete(); // uncommenting fixes the memory leak
m = new GSMovie(this, "somefile.avi");
m.play();
}
}

I suggest the destructor of the GSMovie object calls delete() automatically.

Thanks for this wonderful library.
Charles

Discussion

  • Charles Goyard

    Charles Goyard - 2011-06-13

    oops sorry forgot to say : it's on linux with gstreamer 0.10 and processing 1.5.

     
  • Andres Colubri

    Andres Colubri - 2011-06-29

    Hi, thanks for pointing this out. However, keep in mind that there are no destructors in Java. Alternatively, objects can implement a finalize() method that is called by the GC when the object is not longer referenced. I could put the release of the gstreamer native resources in there, so there is no need for explicit delete() call, but I need to be careful, sometimes using finalizers is not recommended, specially when dealing with native resources due to threading issues (the GC runs in its own thread). I will look at this for the next release of GSVideo.

     
  • Andres Colubri

    Andres Colubri - 2011-10-02
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks