iPod/iPhone 4, iOS 6.1.6, Safari unexpectedly closes during HTML5/CSS3/JavaScript game initialization

91 Views Asked by At

In my HTML5/CSS3/JavaScript application I create instances of the main classes of the game. For example:

function initialize (iconsParamArray) {
    for (var i = 0; i < iconsParamArray.length; i++) {
        this._iconsArray[i] = new Icon(iconsParamArray[i]);
    }
}

The length of the iconsParamArray can be more than one hundred. And sometimes in the middle of this process Safari unexpectedly closes. If I perform browser cache clearing in Safari settings panel, Safari works normally in around 70% of cases. It looks like GC can't collect all garbage from the memory in time. So memory amount exceeded the limit and browser closes.

Has anyone run into the same problem? How can I avoid this unexpected closings? Maybe I have to use setTimeout function for dividing initialization process on few parts?

0

There are 0 best solutions below