R
Robin Gherghetta
Guest
If I create a stack as a local variable:
var stack = ds_stack_create()
Do I still have to destroy it with ds_stack_destroy(stack)? What if i use it in a script and then return it? How can i destroy it after I return it in the script as anything after the return will not execute?
....
return stack;
//this will not execute
ds_stack_destroy(stack);
Same question goes for ds_maps and ds_list. I read in the manual:
NOTE: As with all dynamic resources, data structures take up memory and so should always be destroyed when no longer needed to prevent memory leaks which will slow down and eventually crash your game.
"Always" is even bolded!
var stack = ds_stack_create()
Do I still have to destroy it with ds_stack_destroy(stack)? What if i use it in a script and then return it? How can i destroy it after I return it in the script as anything after the return will not execute?
....
return stack;
//this will not execute
ds_stack_destroy(stack);
Same question goes for ds_maps and ds_list. I read in the manual:
NOTE: As with all dynamic resources, data structures take up memory and so should always be destroyed when no longer needed to prevent memory leaks which will slow down and eventually crash your game.
"Always" is even bolded!