Commit 0872c8a6 authored by 李维's avatar 李维

测试garbageCollect

parent eaa8a0e6
......@@ -416,7 +416,7 @@ export abstract class middleLayerBase extends cc.Component {
async clearDragonDisplayAssetList() {
async clearDragonDisplayAssetList3() {
console.log('喵喵喵: clearDragonDisplayAssetList');
console.log('喵喵喵: ' + this.nodeList.length);
......@@ -511,7 +511,7 @@ export abstract class middleLayerBase extends cc.Component {
}
// 原始方法
clearDragonDisplayAssetList2() {
......@@ -532,9 +532,37 @@ export abstract class middleLayerBase extends cc.Component {
node.removeFromParent();
});
this.textureList.forEach(texture => {
texture.decRef();
});
}
clearDragonDisplayAssetList() {
console.log('喵喵喵: clearDragonDisplayAssetList');
console.log('喵喵喵: ' + this.nodeList.length);
console.log('喵喵喵: ' + this.atlasList.length);
console.log('喵喵喵: ' + this.assetList.length);
console.log('喵喵喵: ' + this.textureList.length);
[ ...this.atlasList , ...this.assetList].forEach(asset => {
asset.decRef();
cc.assetManager.releaseAsset(asset);
cc.sys.garbageCollect()
asset.destroy();
});
this.nodeList.forEach(node => {
node.active = false;
node.removeFromParent();
});
this.textureList.forEach(texture => {
texture.decRef();
cc.assetManager.releaseAsset(texture);
cc.sys.garbageCollect()
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment