Forcing SWF to free allocated memory from codes in FLA timeline

I have a Flash project and I have written some code in a timeline. When I load the SWF file and unload it, the allocated memory is still there and a memory leak occurs every time I load and unload it.

Is there a solution for this?

I tried this, but the memory is not free.

addEventListener(Event.REMOVED_FROM_STAGE, removed);

public function removed(evt:Event) {
    removeEventListener(Event.REMOVED_FROM_STAGE, removed);
    csc = null;
    if (currentFrame == 2) {
        content.removelisteners3()
        try {
            content.removeChildren();
        } catch (e:Error) {
        }
        menu.removeListeners1();

        try {
            mc1.mc.removeChildren();
        } catch (e:Error) {
        }
        try {
            mc1.removeChildren();
        } catch (e:Error) {
        }
    }

    if (currentFrame == 3) {
        menu.removeListeners2()
        try {
            search_ctn.removeChildren()
        } catch (e:Error) {
        }
        try {
            min_search.removeEventListener(MouseEvent.MOUSE_UP, f_min_search);
        } catch (e:Error) {
        }
        try {
            clos_search.removeEventListener(MouseEvent.MOUSE_UP, f_clos_search);
        } catch (e:Error) {
        }
        try {
            btnUpSearch.removeEventListener(MouseEvent.MOUSE_DOWN, f_btnUpSearch);
        } catch (e:Error) {
        }

    }
    try {
        this.removeChildren();
    } catch (e:Error) {
    }
}

      

+3


source to share


1 answer


Deleting files does not guarantee that memory is actually reclaimed by the garbage collector. As long as memory has references to it, it will live on and ...



0


source







All Articles