Solitary Confinement
Member
Heya,
I understand one needs to ensure a ds_list is destroyed once it is no longer needed to avoid memory leaks. What's an efficient way to do this?
If I have the following (just an example, actual project has many more):
list_a=ds_list_create();
list_b=ds_list_create();
list_c=ds_list_create();
Would I need to then have, in room end event:
ds_list_destroy(list_a)
ds_list_destroy(list_b)
ds_list_destroy(list_c)
Surely there is a better way to destroy the lists? I tried destroying the lists by creating a master "destroy" list and adding all the above to that list. On room end, I then used: ds_list_destroy(master_destroy_list[| ds_list_size(master_destroy_list)]), but this threw an error at me.
Any guidance is appreciated. Thanks!
I understand one needs to ensure a ds_list is destroyed once it is no longer needed to avoid memory leaks. What's an efficient way to do this?
If I have the following (just an example, actual project has many more):
list_a=ds_list_create();
list_b=ds_list_create();
list_c=ds_list_create();
Would I need to then have, in room end event:
ds_list_destroy(list_a)
ds_list_destroy(list_b)
ds_list_destroy(list_c)
Surely there is a better way to destroy the lists? I tried destroying the lists by creating a master "destroy" list and adding all the above to that list. On room end, I then used: ds_list_destroy(master_destroy_list[| ds_list_size(master_destroy_list)]), but this threw an error at me.
Any guidance is appreciated. Thanks!