Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TextureMaterial.dispose #417

Closed
fxdevGer opened this issue Sep 25, 2012 · 2 comments
Closed

TextureMaterial.dispose #417

fxdevGer opened this issue Sep 25, 2012 · 2 comments
Assignees

Comments

@fxdevGer
Copy link

Hi,

I use a AWD2Parser to parse an AWD2 Model. This Model uses only one TextureMaterial. I tried to dispose the Mesh and the TextureMaterial, FDT Profiler says that the BitmapData Instance stays in the Player.

I used this code for Material disposing:

_mat.texture.dispose();
_mat.dispose();
_mat = null;

and this code for disposing the Mesh:

_mesh.geometry.dispose();
_mesh = null;

Anyway I dispose my loaded BitmapData like this:

_bitmapData.dispose();
_bitmapData = null;

FDT Profiler show that only my BitmapData has been disposed.

I dont know if this is a bug or I used the wrong code.

@fxdevGer
Copy link
Author

I think I found the Problem. It lies in TextureProxyBase.dispose().

Origin Code was :

for (var i : int = 0; i < 8; ++i)
if (_textures[i]) {
_textures[i].dispose();
_textures[i] = null;
}

I changed it to :

try {
_mipMaps[_width][_height].dispose();
_mipMaps[_width][_height] = null;
} catch(e : TypeError) {}

_mipMapHolder.dispose();
_mipMapHolder = null;

_bitmapData.dispose();
_bitmapData = null;

for (var i : int = 0; i < 8; ++i)
if (_textures[i]) {
_textures[i].dispose();
_textures[i] = null;
}

With the code above I have stable Ram on Loading and Unloading Levels only with loaded Images and BitmapTexture

@ghost ghost assigned DerSchmale Apr 20, 2013
@DerSchmale
Copy link
Member

This fix changes the intended functionality of the code (and contains empty catch blocks ;) ).This should've been fixed properly recently, tho.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants