Commit 21f98065 authored by limingzhe's avatar limingzhe

fix: debug 清内存

parent 1382cf18
import { asyncDelay } from "./util"; import { asyncDelay, randomSortByArr } from "./util";
export abstract class middleLayerBase extends cc.Component { export abstract class middleLayerBase extends cc.Component {
...@@ -429,12 +429,22 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -429,12 +429,22 @@ export abstract class middleLayerBase extends cc.Component {
} }
// this.atlasList[3] = this.atlasList[7]; // this.assetList = randomSortByArr(this.assetList);
// this.assetList[3] = this.assetList[7];
// this.nodeList[3] = this.nodeList[7]; // this.atlasList[0] = this.atlasList[7];
// this.textureList[3] = this.textureList[7]; // this.assetList[0] = this.assetList[7];
// this.nodeList[0] = this.nodeList[7]
// this.textureList[0] = this.textureList[7];
// this.atlasList.length = this.assetList.length = this.nodeList.length = this.textureList.length = 1; // this.atlasList.length = this.assetList.length = this.nodeList.length = this.textureList.length = 1;
// [ ...this.assetList ].forEach(asset => {
// console.log('asset_uuid: ', asset._uuid);
// console.log('asset: ', asset);
// cc.assetManager.releaseAsset(asset);
// });
// [ ...this.atlasList, ...this.assetList ].forEach(asset => { // [ ...this.atlasList, ...this.assetList ].forEach(asset => {
// console.log('asset_uuid: ', asset._uuid); // console.log('asset_uuid: ', asset._uuid);
// console.log('asset: ', asset); // console.log('asset: ', asset);
...@@ -450,14 +460,14 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -450,14 +460,14 @@ export abstract class middleLayerBase extends cc.Component {
console.log('asset_uuid: ', asset._uuid); console.log('asset_uuid: ', asset._uuid);
console.log('asset: ', asset); console.log('asset: ', asset);
// asset.decRef();
cc.assetManager.releaseAsset(asset);
asset.destroy();
while (asset?.refCount > 0) { while (asset?.refCount > 0) {
asset.decRef(); asset.decRef();
} }
// asset.decRef();
// cc.assetManager.releaseAsset(asset);
// asset.destroy();
}); });
this.nodeList.forEach(node => { this.nodeList.forEach(node => {
...@@ -466,8 +476,8 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -466,8 +476,8 @@ export abstract class middleLayerBase extends cc.Component {
}); });
this.textureList.forEach(texture => { this.textureList.forEach(texture => {
console.log('texture_uuid: ', texture._uuid); // console.log('texture_uuid: ', texture._uuid);
console.log('texture: ', texture); // console.log('texture: ', texture);
while (texture?.refCount > 0) { while (texture?.refCount > 0) {
texture.decRef(); texture.decRef();
...@@ -478,18 +488,8 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -478,18 +488,8 @@ export abstract class middleLayerBase extends cc.Component {
}); });
[ ...this.assetList ].forEach(asset => { cc.assetManager.releaseUnusedAssets();
console.log('asset_uuid: ', asset._uuid);
console.log('asset: ', asset);
cc.assetManager.releaseUnusedAssets();
// asset.decRef();
// cc.assetManager.releaseAsset(asset);
// asset.destroy();
});
// this.atlasList.length = this.assetList.length = this.nodeList.length = this.textureList.length = 1;
......
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