CPU and Memory leak in Assets.getMovieClip(), C++ Windows and Android targets

Hi again

Took a while to hunt this down in my project, however i noticed that just accessing movie clips with 2 or more frames in swf file through Assets.getMovieClip significantly increases overall CPU and memory usage. Meanwhile movie clips with just 1 frame has almost no effect.

Libraries: openfl:[2.2.8], lime:[2.2.2], swf:[1.8.2]

Targets: C++ (CPP), Windows and Android, Debug and Release builds (some weird constant memory allocations happen in flash target too)

Testing: new project with just 1 swf library (test_assets.swf)

Tests (Windows, Release):

1)
code: none
resources used: working set = ~44 MB, private working set = ~27 MB, constant ~5% CPU usage (also ~5% in debug mode)

2)
code:

for (i in 0...10000) {
	Assets.getMovieClip("test_assets:asset_square1frame"); // simple 100x100 square movieclip with 1 frame
}

resources used: working set = ~46 MB, private working set = ~29 MB, constant ~5% CPU usage (also ~5% in debug mode)

3)
code:

for(i in 0...1000) { // note: it's 10x less than previous test
	Assets.getMovieClip("test_assets:asset_square2frames"); // simple movieclip with 2 frames, each frame has 100x100 square
}

resources used: working set = ~52 MB, private working set = ~35 MB, constant ~20% CPU usage (~50% in debug mode)

4)
code:

for(i in 0...1000) {
	Assets.getMovieClip("test_assets:asset_square50frames"); // simple movieclip with 50 frames, each frame has 100x100 differently colored square
}

resources used: working set = ~207 MB, private working set = ~190 MB, constant ~20% CPU usage (with additional ~0-10% fluctuations)

So, my asset workflow is like this:

  1. Get movie clip from swf.
  2. Apply some transformations and convert to BitmapData’s. (from this point i don’t need movie clip from swf anymore)
  3. Pack to sprite sheets.
  4. Use OpenFL tilesheet to render on Windows and Android targets.

A lot of this stuff is done during runtime and it only adds a few seconds of loading time on Samsung Galaxy S3 phone. And lots of assets are in vector form, so it greatly reduces App size. The solution would be to directly embed sprite sheets, however the App size is already at 50MB. My question would be if there is any way to get bitmap data’s from MovieClip’s without major downsides?

Perhaps the animation code for type “swf” could be improved, or, have you tried “swflite”? It may perform much better, it does not have animation support yet, but this could be added