PV3D 的内存问题太严重了
ericvan76 (2009-04-02 16:08:20)
我们知道Flex本身的内存回收就有一些问题,而PV3D也有一些问题,比如说Cube的destroy,
public function destroy():void
{
var mat:MaterialObject3D;
for each(mat in materials){
mat.unregisterObject(this);
}
}
materials不是Collection,好像没有办法被cycle到吧,我把它改成了materials.materialsByName 才对,另外我又加了些其它处理:
public function destroy():void
{
var mat:MaterialObject3D;
for each(mat in materials.materialsByName){
mat.unregisterObject(this);
materials.removeMaterial(mat);
mat=null;
}
this.materials=null;
this.geometry.vertices.splice(0,geometry.vertices.length);
this.geometry.faces.splice(0,geometry.faces.length);
this.geometry.vertices=null;
this.geometry.faces=null;
this.geometry=null;
}
这样一来,从StatsView里面看mem占用情况减少了好多。("好多"是因为我的case里有1000个Cube)看来PV3D里面的问题还真不少,希望在PVX中有所改善。