Disposing of unused BitmapMaterials

Software: Away3D 4.x

Avatar
theMightyAtom, Sr. Member
Posted: 21 February 2012 11:24 AM   Total Posts: 669

I’m having memory issues using the Beta (and previously the alpha).
I remove the BitmapMaterial using .dispose(), and even force Garbage Collection (System.gc() x 2) and yet memory usage doesn’t go down and eventually I get an error:

Error #3684: Texture creation failed. Internal error

Which suggests to me that there’s no memory left for textures.
As a work around I am pooling my materials, i.e. reusing the same material with a new bitmapData, put I always end up with materials that are not in use but are still using memory.

Any ideas/advice much appreciated :O)

   

Avatar
Fabrice Closier, Administrator
Posted: 21 February 2012 12:15 PM   Total Posts: 1265   [ # 1 ]

BitmapMaterial is deprecated. Use TextureMaterial instead.
oh and you need to dispose the textures too if you have made some.
mat.texture, mat.normalMap and mat.specularMap
same rule if you declare methods such as enviromap holding bitmapdatas.

   

louis87, Jr. Member
Posted: 22 February 2012 09:36 AM   Total Posts: 46   [ # 2 ]

Okay, if I understand, I can create a library of a BitmapTextures, and every time I need a TextureMaterial, for example for a level, I can create a new TextureMaterial using that BitmapTexture.

Then, when I want to dispose my level I have to dispose all my TextureMaterial…

Thats correct?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X