Is assetLibrary.unload() working properly for SWFs?


Problems encountered when using the Swf library: Is this line of code working properly? I found that its implementation is empty, and after calling this, the memory is not reduced. If I use Assets.unloadLibrary, it will cause me to not load next time. What am I missing?

OpenFL 8.3.0 Release

I believe we should be preloaded resources when an asset library is loaded, unloading should remove it from openfl.utils.Assets and discard some of this preloaded data, but ultimately whether things are removed from memory will be based on the garbage collector. Also if any of the loaded resources are still in use, it may still remain in memory. unload() is not an aggressive dispose() type of behavior. Any assets still in use in your project will still continue to work

	<library path="Swfs/LittleGirlSellingFlowers.swf"/>

How does this tag work in the code?How does this tag work in the code? Is it the same as the following example:

var library:AssetLibrary = AssetLibrary.fromFile("lib/test.json");

I want to be able to simulate a repository like the XML tag, so I can try to uninstall the resource through Assets.unloadLibrary.


Yes, it should be similar, though I believe that <library path="" /> may register it with the core preloader

So maybe add an stage.application.preloader.addLibrary reference after it is loaded


Memory still can’t be released, even reaching 500MB, it has no effect, I used the following API:



Hmm, then perhaps this might require some more testing