Hello guys,
I am a bit lost about what I am coding.
I got multiple render.Drawtext() in my main, and the strings they show are updated by a 0AD1: function.
I got some crashes and I think it's about memory problem.
I don't really know how to handle my memory in this case. In fact, I would like to know, if you alloc memory into a function 0AD1: then does the compiler understand that the returned value is alloced 260 then will automaticaly alloc the same ammount of memory for the variable in the main ? Like
I am a bit lost about what I am coding.
I got multiple render.Drawtext() in my main, and the strings they show are updated by a 0AD1: function.
I got some crashes and I think it's about memory problem.
I don't really know how to handle my memory in this case. In fact, I would like to know, if you alloc memory into a function 0AD1: then does the compiler understand that the returned value is alloced 260 then will automaticaly alloc the same ammount of memory for the variable in the main ? Like
Code:
0@ = load font verdana blablablablabla + starting stuff
While true
wait 0
// Conditions here
0AD1: @An_Amazing_Function 0 1@
// End of condition
// Do things here
//Conditions here
render.drawtext(0@, 1@, 10, 210, -1)
//End
end
:An_Amazing_Function
// Conditions + Do things here
alloc 25@ = 260
0AD3: 25@ = format "%s" 11@
0AD2: ret 1 25@
- Will the compiler automaticaly alloc 1@ = 260 because it's a returned value that has already been allocated in the 0AB1: function?
- Will the compiler automaticaly "free 25@" at the end of the function ?
- Should I alloc 1@ = 260 at the begining of the script to avoid crashes ?
- What happens if I alloc 260 a lot of variable (even if it's useless) and never "free" them ?