What should I free?
BlitzPlus Forums/BlitzPlus Beginners Area/What should I free?
| ||
OK, I know that if I make many objects in a game that I plan to resuse later in the game, I should free the object and any associated sounds and images etc. But what do I need to free when the program exits? e.g. music, sounds, title screens etc. I know I could free everything but the help for FreeSound says "Note: You don't have to manually free these resources when your program terminates - Blitz does this automatically." Fine, but what about FreeImage, FreeFont and FreeTimer, do I need to bother with these or are they automatic? Does anyone know? Also I am playing some in game music (a mod) with handle% = PlayMusic("whatever", 1) but you cannot free the handle later with FreeSound handle% , it errors with Invalid Source Handle. Is this OK? |
| ||
what about FreeImage, FreeFont and FreeTimer, do I need to bother with these or are they automatic? Blitz automatically cleans everything up at program end. You really only need to be worried about performance issues that might be improved through manually freeing resources during runtime. If it makes no difference, then don't worry about it. Also I am playing some in game music (a mod) with Probably because you are trying to free a sound with a MUSIC handle. handle% = PlayMusic("whatever", 1) but you cannot free the handle later with FreeSound handle% , it errors with Invalid Source Handle. Is this OK? |
| ||
PlayMusic doesn't load the mod file into ram. It just streams the music directly form disk. So there is nothing to free. |
| ||
Great advice guys, thanks loads and Happy New Year! |