[LayaNative3]new CommondBuffer 没有回收释放,每次用完,直接给置成null,每次buffermemory都会增长,不会下降
1. 内存泄露问题 ,const buffer = new CommandBuffer后 用完将对象置成null,buffermemory 不会下降。
2. 想自己去回收内存, 辗转到Command Buffer中的DrawMeshInstancedCMD 类中,this._curDrawMeshInstancedCMD = cmd.drawMeshInstance(this._mesh,0,this.transformMatrices,this._mat,0,this.materialBlock,this.transformMatrices.length); 这个方法中拿到这个DrawMeshInstancedCMD对象,然后执行recover,发现逻辑bug,如附件中贴图所示,回收对象池的时候把对象拥有的变量给销毁了,如下:
this._instanceBufferState.destroy();
this._instanceBufferState = null;但是在下次Create的时候因为是从池子中拿出来的,所以 this._instanceBufferState 没有了
2. 想自己去回收内存, 辗转到Command Buffer中的DrawMeshInstancedCMD 类中,this._curDrawMeshInstancedCMD = cmd.drawMeshInstance(this._mesh,0,this.transformMatrices,this._mat,0,this.materialBlock,this.transformMatrices.length); 这个方法中拿到这个DrawMeshInstancedCMD对象,然后执行recover,发现逻辑bug,如附件中贴图所示,回收对象池的时候把对象拥有的变量给销毁了,如下:
this._instanceBufferState.destroy();
this._instanceBufferState = null;但是在下次Create的时候因为是从池子中拿出来的,所以 this._instanceBufferState 没有了
没有找到相关结果
已邀请:
要回复问题请先登录
0 个回复