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.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › Movie does not completely dispose() when called.
Page Index Toggle Pages: 1
Movie does not completely dispose() when called. (Read 286 times)
Movie does not completely dispose() when called.
Feb 25th, 2009, 3:22am
 
I'm making an application that opens and disposes movies frequently.  After a few movies the processor begins to tank and things slow down.  

I'm making sure to dispose old movies (there is only one movie active at any particular time) before a new one is opened, but it appears that something is left running or unhandled.  When the application is finally closed, I get an error message for each of the previous movies that were disposed.

There error messages are all of this form:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:707)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:700)
at processing.core.PApplet.stop(PApplet.java:650)
at processing.core.PApplet.run(PApplet.java:1355)
at java.lang.Thread.run(Thread.java:613)
Caused by: quicktime.QTNullPointerException: This QTJava object was allocated in a previous QTSession and is no longer valid:quicktime.std.movies.Movie
at quicktime.QTObject._ID(QTObject.java:80)
at quicktime.std.movies.Movie.setTimeValue(Movie.java:1313)
at processing.video.Movie.stop(Movie.java:533)
at processing.video.Movie.dispose(Movie.java:722)
... 9 more


It looks like the runner thread is being successfully stopped (watched in a process monitor) since the thread count does not increase.


Here is a simple app that reproduces the error.  It loads a new movie every draw() frame, so you should get a number of errors proportional to how long you leave the application open.  The errors will appear in the console when you close the app.  Just put a movie ("station.mov" is used here) when Movie() can find it and hit run.


//
// this is a nonsense app that reproduces an
// error I've been getting with the Movie class.
//
// When disposing a video, it looks like something
// is not being fully taken care of, and later when
// the application completely exits, the Exceptions
// come raining down. :(
//
//  - adam (kumpf@media.mit.edu)
//

import processing.video.*;
Movie movie;

void setup(){
 size(100, 100);
 frameRate(1);  // this produces an error at every frame, so be slow.
}

void draw(){
 if(movie != null){
   movie.dispose();
   movie = null;
   println("stopped and disposed the movie");
 }
 movie = new Movie(this, "station.mov", 15);
 movie.play();
 println("started a new movie");
}

// Called every time a new frame is available to read
void movieEvent(Movie m) {
 m.read();
}

void dispose(){
 if(movie != null){
   movie.dispose();
   println("stopped and disposed movie during exit.");
 }
}




thanks,
Adam



Page Index Toggle Pages: 1