A recent project encountered loading external images caused high memory problems, through a variety of search finally solved, in fact, in the new version of Flash Player has a relevant method.
Project, a picture loaded into a file exists in the form of a bitmapdata class, even if remove or set to NULL is still useless.
Help can see that BitmapData has a method, Dispose, as follows:
Dispose () method
Public function Dispose (): void
Language version: ActionScript 3.0
Runtime version: Flash Player 9, AIR 1.0, Flash Lite 4
Frees the memory used to store the BitmapData object.
When you call the Dispose () method on an image, the width and height of the image is set to 0. All subsequent calls to the method or property of this BitmapData instance will fail and throw an exception.
Bitmapdata.dispose () Immediately releases the memory occupied by the actual bitmap data (a bitmap can use up to a maximum of MB of memory). With Bitmapdata.dispose (), the BitmapData object is no longer available, and if a function is called on the BitmapData object, the Flash runtime throws an exception. However, Bitmapdata.dispose () does not use the BitmapData object (approximately 128 bytes) as garbage collection, and the memory that is consumed by the actual BitmapData object is released when the BitmapData object is collected by the garbage collector.
Combined with the System class GC method, the memory is completely freed, at least the problem in my project has been solved.
GC () method
public static function GC (): void
Language version: ActionScript 3.0
Runtime version: AIR 1.0, Flash Player 9.0.115.0, Flash Lite 4
Forces the garbage collection process to take.
limited to Flash Player Debug version and AIR application only. in an air application, the System.GC () method is enabled only in content that is running in air Debug Launcher (ADL) or in the application security sandbox of an installed application.
However, it is important to note that the picture is not used after the call, otherwise it will not be displayed directly.
FLASH AS3 Image Memory Removal method