[]内存释放问题
下面写的释放有什么问题吗?为什么我的内存没有变化,Laya.loader下面的_infoPoll 没有发生变化,
public dispose(): void {
this.ani.clear();
Laya.Animation.clearCache(this.resUrl);
this.ani = null;
Laya.loader.clearRes(this.resUrl, true);
}
我单独写了一个例子,这样释放没有问题,内存明显有变化,但是Laya.loader下面的_infoPoll 没有发生变化,就是还有res/atlas/effect/playerEff/shengji.json的信息。
for (let i = len - 1; i >= 0; i--) {
key = this._poolDic.keys
temp = this._poolDic.get(key);
if (temp) {
this._poolDic.remove(key);
temp.clear();
Laya.Animation.clearCache(key);
Laya.loader.clearRes('res/atlas/effect/playerEff/shengji.json');
}
}
问: 内存释放原理是什么样的?
public dispose(): void {
this.ani.clear();
Laya.Animation.clearCache(this.resUrl);
this.ani = null;
Laya.loader.clearRes(this.resUrl, true);
}
我单独写了一个例子,这样释放没有问题,内存明显有变化,但是Laya.loader下面的_infoPoll 没有发生变化,就是还有res/atlas/effect/playerEff/shengji.json的信息。
for (let i = len - 1; i >= 0; i--) {
key = this._poolDic.keys
temp = this._poolDic.get(key);
if (temp) {
this._poolDic.remove(key);
temp.clear();
Laya.Animation.clearCache(key);
Laya.loader.clearRes('res/atlas/effect/playerEff/shengji.json');
}
}
问: 内存释放原理是什么样的?
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Monica - 知识达人
赞同来自:
Canvas模式下清理掉资源之后内存就会及时的释放,
WebGL模式下会把小于512的资源默认会被存到我们的动态图集里,这些资源的内存占用你手动清理不掉,在动态图集资源存满了,我们会把不用的资源顶替掉