buildAnimation: function () {
this._animation = new cc.Animation();
var frame;
var i = 1;
while (true) {
frame = cc.spriteFrameCache.getSpriteFrame(this._prefix + "_" + i + ".png");
if (!frame)
break;
this._animation.addSpriteFrame(frame);
i++;
}
this._animation.setDelayPerUnit(this._delayPerUnit);
this._animation.retain();
},
play: function () {
this._isPlayOK = false;
var action = cc.animate(this._animation);
if ((this._cb && this._cbtarget) || this._repeat >0) {
action = cc.sequence(action, cc.callFunc(this.finish, this));
}
if (this._repeat) {
action = action.repeat(this._repeat);
} else {
action = action.repeatForever();
}
this.runAction(action);
},
_clearAnim:function(){
if (this._animation != null) {
this._animation.release();
delete this._animation;
}
if(this._plist!=""){
cc.spriteFrameCache.removeSpriteFramesFromFile(this._plist);
}
},
使用 new cc.Animation 造成内存持续飙升,然后iOS上崩溃,求大佬指导。
cocos2d-js 3.16
我的图集是固定数量的,就十几个。
最新进展:一旦调用cc.sys.garbageCollect 方法后内存不再迅速增加,怎么解释?cocos大佬帮我看看哈。
==================================
但是cocos2d:Animate 一直是在增加的,数量越来越多,cc.sys.garbageCollect也清不掉

