Memory Management Actionscript?

I saw System.gc() somewhere on the Internet today, and I wanted to know if this is or is not recommended for use in a Flash CS5 project and why.

+4
source share
3 answers

In every garbage collection that I know of, the garbage collection machine was designed to work in the background as an abstraction that the programmer should not theoretically pay attention to. There are some special situations where forced builds are useful, but they are usually associated with interrupts (real machine interrupts, not actionscript events), test / debug scripts, or some complex expectations management tasks. Most likely, you will never need to call System.gc (), and you can safely ignore it.

+4
source

System.gc () is only available in the version of the Flash Player debugger and some AIR applications. Calling it on a regular website under a regular Flash Player will have no effect and will fail.

System.gc () is for testing purposes only.

0
source

System.gc () is for testing purposes only. It may be convenient to monitor the memory usage used by your application and call System.gc () to emphasize the possibility of a memory leak.

Tip. As far as I remember, you need to call System.gc () twice to make it compile immediately.

The documentation states that this method only works in the debug player.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/System.html#gc ()

So, to summarize, if you are testing memory, it is very convenient, otherwise do not use it.

0
source

All Articles