Tue 18 Dec 2007 08:44:29 AM UTC, original submission:
External .SWF files loaded with loadMovie() are kept in memory forever, even if there is no instance of them left.
Judging from the message "Movie XXXXX (SWF6) added to library" I guess that freeing objects from that "library" is not implemented. I didn't look at the code, though.
Testcase
Save the two attached files to a directory, "cd" into it and start this command (all in one line):
x=0 ; while [ $x -lt 100 ]; do x=$(expr $x + 1) ; echo $x ; cp bitmap-movie.swf bitmap-movie-$x.swf ; done
This will generate 100 copies of the file "bitmap-movie.swf", which is necessary because Gnash will load a single file only once into the "library".
Then start gnash playing "bitmap-movie-loader.swf" and watch it's memory usage which will quickly increase.
ActionScript used in the loader movie
list = new Array();
depth = 1;
this.onEnterFrame = function() {
depth++;
var foo = _root.createEmptyMovieClip("foo"+depth, depth);
foo.loadMovie("bitmap-movie-"+depth+".swf");
foo._x = (depth % 10) * 10;
foo._y = foo._x;
list.push(foo);
if (list.length > 5) {
foo = list.shift();
foo.removeMovieClip();
}
}
Description: Loads one .swf file in each frame. Once 5 movies are visible, the oldest is being removed and it's definition could be freed (but isn't apparently).
|