0

LoaderMax uses the following function in their DisplayObjectLoader.as class which is under loader/core :

Although they have put the forced GC under a Try/Catch block. Flash Player 11 still manages to crash on it. Any ideas about this?

protected static function _forceGCHandler(event:Event):void {
        if (_gcCycles == 0) {
            _gcDispatcher.removeEventListener(Event.ENTER_FRAME, _forceGCHandler);
            _gcDispatcher = null;
        } else {
            _gcCycles--;
        }
        try {
            new LocalConnection().connect("FORCE_GC");
            new LocalConnection().connect("FORCE_GC");
        } catch (error:Error) {

        }
    }
John Slegers
  • 45,213
  • 22
  • 199
  • 169
Fahim Akhter
  • 1,617
  • 5
  • 31
  • 49
  • I don't think this particular code crashes FP. There's one bug I've recently submitted https://bugbase.adobe.com/index.cfm?event=bug&id=3071138 , in the sample I did I use same GC trick — it doesn't crash. – average dev Dec 23 '11 at 22:12

2 Answers2

0

Perhaps you could edit the forced gc out and use System.pauseForGCIfCollectionImminent(0.25)

Hawks
  • 534
  • 3
  • 14
0

To connect 2 different connections you can try:

new LocalConnection().connect("FORCE_GC");
new LocalConnection().connect("FORCE_GC1");

But I don't know will this force the GC.

Cosmin
  • 21,216
  • 5
  • 45
  • 60