GuiControl SetBitmap - memory leak until crash
by Vladan Markovic · in Torque Game Builder · 12/06/2011 (1:23 pm) · 2 replies
Hi,
I have a lot of GuiControl (GuiBitmapControl) in which i dynamically change bitmap,
now it seems that there is no way to release old bitmap when setting new ones in control.
For example: (
new GuiBitmapCtrl(transitionBG) { ... };
transitionBG.Bitmap=(%imgStc1); // %imgStc`s are huge fullscreen bitmaps
Task Manager shows: TorqueGameBuilder: 100mb
transitionBG.Bitmap=(%imgStc2);
Task Manager shows: TorqueGameBuilder: 150mb
transitionBG.Bitmap=(%imgStc3);
Task Manager shows: TorqueGameBuilder: 200mb
etc ... until it crash with system Low Memory error.
I looked at the engine code, the function that is called is:
mTextureHandle = TextureHandle(mBitmapName, BitmapTexture, true);
Which creates new texture in memory if don't exist, or get existing one if it finds it,
I cant find function to release bitmap handles that i do not need anymore before i load new one.
Something like:
transitionBG.DestroyOldTexture(); //delete existing texture handle
transitionBG.Bitmap = (%imgStc3); // create new texture handle
This is major problem in our current game design, please help.
Thank You.
I have a lot of GuiControl (GuiBitmapControl) in which i dynamically change bitmap,
now it seems that there is no way to release old bitmap when setting new ones in control.
For example: (
new GuiBitmapCtrl(transitionBG) { ... };
transitionBG.Bitmap=(%imgStc1); // %imgStc`s are huge fullscreen bitmaps
Task Manager shows: TorqueGameBuilder: 100mb
transitionBG.Bitmap=(%imgStc2);
Task Manager shows: TorqueGameBuilder: 150mb
transitionBG.Bitmap=(%imgStc3);
Task Manager shows: TorqueGameBuilder: 200mb
etc ... until it crash with system Low Memory error.
I looked at the engine code, the function that is called is:
mTextureHandle = TextureHandle(mBitmapName, BitmapTexture, true);
Which creates new texture in memory if don't exist, or get existing one if it finds it,
I cant find function to release bitmap handles that i do not need anymore before i load new one.
Something like:
transitionBG.DestroyOldTexture(); //delete existing texture handle
transitionBG.Bitmap = (%imgStc3); // create new texture handle
This is major problem in our current game design, please help.
Thank You.
Torque Owner Rpahut