memory disposal does not seem to have any effect on GPU memory

Software: Prefab3D

Thonbo, Newbie
Posted: 28 May 2013 08:05 AM   Total Posts: 10

Hey Away team - Im working on an game app project for iOS / Android where we want to use Away3D in the first scene.. And because we have to target iPad1 and tegra2 android devices we need to be able to clean up memory on a greater basis - im using prefab to generate most of the scene

the problem:
When we have disposed all objects textures materials events we get a close to zero memory footprint CPU wise - but the gpu memory has no effect at all it keeps being maxed out with 31mb og bitmap data - its a simple scene with 3 texture maps no light no shaders only flat textures and a camera - we use proxyStage3D.dispose and disposeAllAsstes on everything i even gather all reference to all texture bitmaps in a vector and clear that - we use following lines to clean up

  System.pauseForGCIfCollectionImminent(0.20)
  _prefabOutput.disposeAsset()
  _prefabOutput.dispose()
  _prefabOutput.destroy() //method i wrote to dispose content in all vectorArrays of “ASbase.as”
  _prefabOutput.destroyMats() //method i wrote to dispose textures and mats in all vectorArrays of “ASbase.as”
  _view.stage3DProxy.dispose()
  System.gc()

   

Avatar
Fabrice Closier, Administrator
Posted: 28 May 2013 10:09 AM   Total Posts: 1265   [ # 1 ]

These readings are on device or on desktop?

Make sure that the clearing of materials also do hold the disposal of textures.
Nullifying a material/texture is not enough.

   

Thonbo, Newbie
Posted: 28 May 2013 10:23 AM   Total Posts: 10   [ # 2 ]

Fabrice these are my changes to ASbase

public function destroy():void{ 
   
for(var j:int 0j<_containers.length;j++){
    ObjectContainer3D
(_containers[j]).disposeAsset()
    
ObjectContainer3D(_containers[j]).dispose() 
   
}
   
for(var k:int 0k<_meshes.length;k++){
    Mesh
(_meshes[k]).disposeAsset()
    
Mesh(_meshes[k]).dispose() 
   
}
  }
  
public function destroyMats():void{
   
for(var l:int 0l<_textures.length;l++){
    BitmapData
(_textures[l]).dispose()
   
}
   
for(var i:int 0i<_materials.length;i++){
    TextureMaterial
(_materials[i]).texture.dispose()
    
MaterialBase(_materials[i]).dispose()
   
}
  } 

///////////////////////////////////////////////

protected function prepareTextureMaterial(url:String):TextureMaterial
  {
   trace
("prepareTextureMaterial BMD: "+defaultBitmapData)
   
_textures.push(defaultBitmapData);
... 
   

Avatar
Fabrice Closier, Administrator
Posted: 28 May 2013 11:00 AM   Total Posts: 1265   [ # 3 ]

Make sure you destroy all textures. normalmaps, enviromethods, skyboxes etc..
As you have a list of materials, i’d loop over these, check if there is a method using texture and clear the textures by using dispose method (no just mat.texture if you ave other kinds such as normalmaps), then dispose the texture.bitmapData’s that you have stored (and this vector too), then the texture, then the material, then the geometry, then removechild from container, then delete the mesh, and finally the container.

Its a lot of “then’s”, but if you apply them, it should be ok.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X