Skip to content

Memory leak when exporting html5 canvas from Flash CC 2015 #1

@dvhoafrontflip

Description

@dvhoafrontflip

Hi guys,

I'm using Flash CC 2015 publish a Html5 banner, open it on chrome for 30 minutes and the huge memory waste on my PC. I had tried to reproduce this problem on both chrome, firefox latest version and the same things.

Memory leak in 2 context:

  1. As you can see in Chrome task manager, memory still increase while the tab is in focus.
    memory leak
  2. Switching to another tab, the banner's still eating more memory.
    I tried to add more 25 banners by loading into 25 iframes in a single page and final result memory was increased so fast.

To Fix it:
An workaround for context 2 by edit the publishing html file and adding some small function to listen "visibilitychange" event when user switch tab and stop the ticker when tab lost focus:

var isActive = true;

function onStopAnimation() {
    createjs.Ticker.removeEventListener("tick", stage);
}

function onStartAnimation() {       
    if(isActive == true) {              
        createjs.Ticker.addEventListener("tick", stage);
    }else {
        onStopAnimation();
    }
}

function handleVisibilityChange() {
    if (document.hidden) {     
        isActive = false;
        onStopAnimation();
    } else {            
        isActive = true;
        onStartAnimation();
    }
}

document.addEventListener("visibilitychange", handleVisibilityChange, false);   

For context 1, it looks like the ticker still running and redawn the object?
any tips for how to work around when we public html with flash cc 2015

Thanks,
Hoa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions