Friday, October 21, 2011

Force garbage collection In Flex

Nothing really new here.
However, I had to modify one of the classes I used before in order to be able to use it in Flex 4.* SDK so I decided to put it here - maybe someone will find it useful as well.
What this class does is that it forces garbage collection in some time interval (by default it runs every 15 seconds).
To be able to use it, download it from herehttp://candymandesign.com/share/blog/files/GarbageCollectionRunner.zip

After that you simply call a static method:

import com.candymandesign.utils.GarbageCollectionRunner;


GarbageCollectionRunner.run();


As optional parameter you can provide a time interval to tell to garbage man when to return back. Those who have a habit to read the code after download will find in comments that it should be only used in development - never in production.


1 comment:

  1. Can't use System.gc() to for Garbage collector to run?

    ReplyDelete