S
SirChibi
Guest
I have a game that I am working on and recently started to play around with paths. I however, noticed that my game started to stutter over time and it just get worse and worse. I think I have narrowed down the issue to the path_delete function.
At first I was creating paths in a list using path_duplicate similar to this:
ds_list_add(testList, path_duplicate(testPath));
I then after some code would delete the list and noticed my game started to fall apart after a short time. so I thought that I needed to delete each path in the list one by one, like so:
for(var i = 0; i < ds_list_size(testList)l i++){
path_delete(ds_list_find_value(testList, i));
}
This didn't seem to help the issues though. I was still having a memory leak. After a lot of debugging and testing around I ended up creating a new project and added in some small test code of this:
for(var i = 0; i < 100; i++){
var test = path_add();
path_delete(test);
}
Using the debugger and the debugging graphs I can see the the memory leak is really bad with this code, I even tested the code without the loop and its still there, it's just a lot slower. I am not fully understanding why this code is causing issues and would love any help. I am very new to these forums so I hope I am correctly posting.
TLDR:
var test = path_add();
path_delete(test);
Is causing a memory leak, and I don't know why.
At first I was creating paths in a list using path_duplicate similar to this:
ds_list_add(testList, path_duplicate(testPath));
I then after some code would delete the list and noticed my game started to fall apart after a short time. so I thought that I needed to delete each path in the list one by one, like so:
for(var i = 0; i < ds_list_size(testList)l i++){
path_delete(ds_list_find_value(testList, i));
}
This didn't seem to help the issues though. I was still having a memory leak. After a lot of debugging and testing around I ended up creating a new project and added in some small test code of this:
for(var i = 0; i < 100; i++){
var test = path_add();
path_delete(test);
}
Using the debugger and the debugging graphs I can see the the memory leak is really bad with this code, I even tested the code without the loop and its still there, it's just a lot slower. I am not fully understanding why this code is causing issues and would love any help. I am very new to these forums so I hope I am correctly posting.
TLDR:
var test = path_add();
path_delete(test);
Is causing a memory leak, and I don't know why.