gb81
YaBB Newbies
Offline
Posts: 1
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!