Clearing variables from memory
BlitzPlus Forums/BlitzPlus Programming/Clearing variables from memory
| ||
In games that require the capability to use large amounts of memory, but often not all at once, how does one go about freeing up the memory that was used by those variables? I think that all it takes is settting the variable equal to zero, but I'm unsure. Could someone please clarify for me? |
| ||
Setting a variable to zero does nothing. You shouldn't need to free up memory in most cases (you really shouldn't have that many variables to worry about!), but you can in some instances: Arrays: Dim myArray(0,0) Banks: FreeBank myBank Types: Delete Each myType Also, if you use local variables in functions they will be free'd at the end of the function call. |
| ||
Thanks much, I appreciate the help. And I think two (possibly more in the future) arrays holding data for each pixel on the screen, another for the data for each possibility for each of those pixels, and yet another for possible interactions between two of those possibilities qualifies as a lot of variables =D Especially since I would like to keep the resolution fairly high. Do the math for an 800x600 resolution and the amount of possibilities and interactions I'm planning and you get about 2x10^10. That's two trillion variables. [EDIT] Heh heh, did my math wrong... It's even more - 39321600000000 3.93*10^13 make that almost 400 trillion =| maybe I should consider some lower resolutions. |
| ||
just maby. |
| ||
In my mind an array is only one variable. But of course it can be a lot of data/memory. |
| ||
What I sort of meant was clearing part of an array from memory. (all the values equal to zero, which would be a decent amount) |