Freeing resources

Previous topic - Next topic

Omadan

Hi guys.

Kitty or anyone who knows, can you please advise me on the following and if its 100% correct. I need 100 guarantee, thanks in advance.

(LoadSprite "",xxx) will release sprite number xxx from memory. This includes LoadAnims too right? LoadSprite "",xxx will release LoadAnim "",xxx,w,h from memory.

Is it also correct to say LoadSound "",xxx frees up a previously loaded sound with handle xxx?

And LoadFont "",xxx will release Font too?

Thanks all.
Top Arcade Apps - Best game for mobiles and computers

http://www.toparcadeapps.com

mentalthink

Yes Omadan, anything you load... if load something don't exist you free the memory...
If you have iPhone you can see whit the tools come in Xcode... in example load bunch of media files and then unload, you can see the graphic of Memory leak, how goes down very quick...

You can free memory from arrays too, *search a bit in the forum never remenber well the answer...
If you do dim[0], then this arrays dissapperas...

I think MrT made a lib whit alloc and dealloc, but really I never uses... I suppose whit this lib you can free variables constants and all this things...

Regards Omadan, too much time whitout see you  ;)

MrTAToad

Any non-existing file with an (already) used id number will de-allocate it.  There was a bug with 3D objects and/or sprites where it didn't work a few versions ago, but that has been fixed.

My alloc/delloc routine is only really useful if you want to conserve every byte of memory for data - don't think anyone uses it :)

Omadan

Thanks guys. :P

Cya soon :P
Top Arcade Apps - Best game for mobiles and computers

http://www.toparcadeapps.com

Jonás Perusquía

#4
Also you can free some TYPE and ARRAY memories by using


Code (glbasic) Select
GLOBAL typearray[] as typename;

FOREACH ítem in typearray[]
DELETE ítem
NEXT



You can use types as arrays or not, you are free to do what you want, but this way yo free memory too :)

PS. i know you asked about LOAD### commands, but the others have already replied xD

Quote from: mentalthink on 2013-Apr-02
You can free memory from arrays too, *search a bit in the forum never remenber well the answer...
If you do dim[0], then this arrays dissapperas...
hey mentalthink, this is the same as what i suggested right? which one is more memory friendly? thank you
<HTML><BASIC><EC>
Be free and do good things