You are not logged in.
Ok, so i've officially gotten so uber graphic heavy (game looks pretty!) that i am going to start loading some of the larger images (and the ones i don't use too often) from the SD card.
Example... my rules pictures. They only get loaded when you go into the rules menu... and then they get freed when you leave.
However, i don't thing they are fully being freed, because after going into the rules menu a number of times (probably by the 10th time) the images don't show up.
Almost like i load the images, then free them, only they don't get fully freed, so by the tenth load, i'm out of memory...
I'm using
GRRLIB_texImg* img_crules1 = GRRLIB_LoadTextureFromFile("sd:/imagesc/crules2.png");
GRRLIB_texImg* img_crules2 = GRRLIB_LoadTextureFromFile("sd:/imagesc/crules2.png");
GRRLIB_texImg* img_crules3 = GRRLIB_LoadTextureFromFile("sd:/imagesc/crules3.png");
GRRLIB_texImg* img_crules4 = GRRLIB_LoadTextureFromFile("sd:/imagesc/crules4.png");
GRRLIB_texImg* img_crules5 = GRRLIB_LoadTextureFromFile("sd:/imagesc/crules5.png");
GRRLIB_texImg* img_crules6 = GRRLIB_LoadTextureFromFile("sd:/imagesc/crules6.png");
GRRLIB_texImg* img_crules7 = GRRLIB_LoadTextureFromFile("sd:/imagesc/crules7.png");
to load the images when you go to the rules menu and
GRRLIB_FreeTexture(img_crules1);
GRRLIB_FreeTexture(img_crules2);
GRRLIB_FreeTexture(img_crules3);
GRRLIB_FreeTexture(img_crules4);
GRRLIB_FreeTexture(img_crules5);
GRRLIB_FreeTexture(img_crules6);
GRRLIB_FreeTexture(img_crules7);
to free the images when i leave.
Any ideas?
Offline
to eliminate as many variables as i could... i just changed it to load one image... draw one image... and then free taht one image.
after about 28 reloads or so, i get the -2 error (out of mem)
when i was doing all 7 images, it happened after about 4 reloads.
So it appears to be proportional... ie stuff is not being freed!
It seems that when you load an image, display it, then free it... you should be back to the same memory state you were prior to loading.
Kinda stuck with this issue as i'll be unable to load images on the fly to save space.
Is there another way to load images? free the memory allocated by this? another test i could do?
thanks!
Last edited by mdbrim (2011-02-06 23:07:16)
Offline
I'm a noob but have you tried setting;
GRRLIB_texImg* img_crules1 = null;
then
GRRLIB_FreeTexture(img_crules1);
hmm that would make any sense. what about
GRRLIB_FreeTexture(img_crules1);
GRRLIB_texImg* img_crules1 = null;
(or whatever is equal to empty pointer )
Offline
i have no idea what happened, but i erased everything, started over... AND NOW IT WORKS FINE!
I didn't change anything!!!
ARG!
Offline
see... but if i add ONE more image to the list of loaded and freed in that routine... it goes back to running out of mem.
don't include that ONE extra image... i can refresh ALL day! makes no sense...
Last edited by mdbrim (2011-02-07 05:00:54)
Offline
i dunno... it seems to be working now.
I had to load them and free them in the "chunks" that they were being displayed. It's weird..
Memory is a strange beast....
Offline
yeah and I think I have a memory issue too. why is there no way to tell how much memory you have left?
Offline