Memory release

hello, some precision in writing please.

All internal variables in a function die on exit, where do we clean them
for example: x :ArrayList(u1) and do a x.clearAndFree() etc.;

as they say there is no garbage collector, I end up getting lost. I apologize there have been videos but my translator is not correctly…

You need to make sure all resources allocated in a function are released prior to returning from the function (one common way is via defer blocks), or that the caller will eventually release any resources returned to it. As you said, there is no automatic garbage collection happening.

if fn () []const u8 {
var x :susize = 0 ;
var array : arraylist …
var string :[] const u8 = “”;

return string;

Normally x and array die by itself
array fixed len

I can kill array by doing an array.clearAndFree();

I can kill the array but is it really useful
except if the size of the array varies of course then I clear

is this correct please