We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
GSvideo memory leak ? (Read 723 times)
GSvideo memory leak ?
Nov 19th, 2009, 3:11am
 
i am trying to make a project that play hd movie with gsvideo library: all works fine except when i try to play different movie. Memory constantly grow up when i switch from a movie to another.

Win XP Pro SP3 - Processing 1.0.9 - gsvideo 0.5.1

Main tab code:

import processing.opengl.*;
import codeanticode.glgraphics.*;
import javax.media.opengl.*;
import codeanticode.gsvideo.*;


char inChar = '1';
char pre_inChar = '1';

PFont fnt;


GSMovie myMovie;
GLTexture tex;

void setup()
{

 size(1920, 1080, GLConstants.GLGRAPHICS);
 frame.setLocation(screen.width,0);
 set_movie();
 fnt = loadFont("BankGothic-Medium-48.vlw");
 



}

public void init(){
 frame.removeNotify();
 frame.setUndecorated(true);
 frame.addNotify();
 super.init();
}

void draw()
{

 background(0);


 println("frameRate: " + frameRate);

 if(inChar == '0') {
   if(pre_inChar != inChar) {
     if(myMovie != null) {
      // myMovie.stop();
       myMovie.dispose();
       System.gc();
     }
   }
   pre_inChar = inChar;

 }
 
 if(inChar == '1') {
   if(pre_inChar != inChar) {

     if(myMovie != null) {
     //  myMovie.stop();
       myMovie.dispose();
       System.gc();
     }
     myMovie = new GSMovie(this, dataPath("") + "ducati_HD-noaudio.mov");
     myMovie.loop();

   }
   pre_inChar = inChar;

   if(myMovie.available()) {
     myMovie.read();
     tex.putPixelsIntoTexture(myMovie);  
   }
   image(tex,0,0);
 }


 if(inChar == '2') {
   if(pre_inChar != inChar) {

     if(myMovie != null) {
    //   myMovie.stop();
       myMovie.dispose();
       System.gc();
     }
   myMovie = new GSMovie(this, dataPath("") + "animal_hd-noaudio.mov");
   myMovie.loop();
   }
   pre_inChar = inChar;

   if(myMovie.available()) {
     myMovie.read();
     tex.putPixelsIntoTexture(myMovie);  
   }
   image(tex,0,0);
 }

 if(inChar == '3') {
   if(pre_inChar != inChar) {

     if(myMovie != null) {
   //   myMovie.stop();
       myMovie.dispose();
       System.gc();
     }
     myMovie = new GSMovie(this, dataPath("") + "mammoth_hd-noaudio.mov");
     myMovie.loop();


 }
 
   pre_inChar = inChar;
   if(myMovie.available()) {
     myMovie.read();
     tex.putPixelsIntoTexture(myMovie);  

   }
   image(tex,0,0);

   
 }
 
 textFont(fnt,248);
 text(inChar,width/2,height/2);

}

second tab code:

void keyPressed() {
 inChar = char(key);  
 
}

third tab code:

void set_movie() {
 
 tex = new GLTexture(this);  

 myMovie = new GSMovie(this, dataPath("") + "ducati_HD-noaudio.mov");
 myMovie.loop();
 
}



in this version i tried to include  a System.gc() too..but it doesn't help! i even tried to stop() before disposal() but memory grow up!

how can i be sure that myMovie is really closed?

Thanks!
Re: GSvideo memory leak ?
Reply #1 - Nov 20th, 2009, 12:04pm
 
ok, I got the example running, and I'll see if I can found the source of the leak.
Page Index Toggle Pages: 1