Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : out of memory error when playing an array of videos sequentially

$
0
0
There is a method in Movie() that sadly isn't explained on the Libraries page for Movie() named dispose(). Dispose() is the way movie deletes an object and clears the memory.

The problem will probably be fixed if you replace .stop() with .delete() in the nextMovie() method:

void nextMovie() {
  myMovies[myMoviesIndex].delete(); //dispose the current movie
  myMoviesIndex=(myMoviesIndex+1) % myMovies.length

I've had this problem as well, and at first I couldn't put my finger on it since the amount of memory available for Processing was always enough for the video I tried to play a number of times. It seemed that the memory leak happened in Movie() and reading the code for Movie.java (available here) showed me that there was a delete function. The stop function only rewinds the player, it doesn't delete it. Because of this, the player remains available and the memory slowly fills with each new movie.

Viewing all articles
Browse latest Browse all 1768

Trending Articles