Scienitive
Member
I'm trying to write a function that does the same thing with instance_place_list() but not with one object with an array of objects.
Here is the function:
And here is the part of code that i call function:
My code is working as I expected but there is a problem.
I'm destroying all the lists that I use but I still end up with memory leak. My memory usage always increases when this code runs.
What am I missing?
Here is the function:
GML:
function instance_place_list_ext(_x, _y, _array, _order, _returnarray) {
var return_count = 0;
var i = 0;
repeat (array_length(_array)){
var list = ds_list_create();
var count = instance_place_list(_x, _y, _array[i], list, _order);
var a = 0;
repeat (ds_list_size(list)) {
ds_list_add(_returnarray[0], list[| a]);
a++;
}
ds_list_destroy(list);
return_count += count;
i++;
}
_returnarray[1] = return_count;
return _returnarray;
}
Code:
var dynamic_list = ds_list_create();
var dynamic_array = [dynamic_list];
dynamic_array = instance_place_list_ext(x, y + sign(vsp), dynamic_objects, false, dynamic_array);
var dynamic_count = dynamic_array[1];
.
.
.
ds_list_destroy(dynamic_list);
I'm destroying all the lists that I use but I still end up with memory leak. My memory usage always increases when this code runs.
What am I missing?