Hello! Here are two small programs that assign nil to a class. The first uses release:
// relex releases memory with .release
class cl {
var ii: int;
}
var v1: cl?;
v1 = new owned cl?(1);
writeln(v1);
v1.release();
writeln(v1);
and the second is brute-force:
// nilex: releases memory??? with '= nil' assignment
class cl {
var ii: int;
}
var v1: cl?;
v1 = new owned cl?(1);
writeln(v1);
v1 = nil;
writeln(v1);
Both produce the same output, but: My question is: relex.chpl probably returns the memory pointed to by v1 to the operating system orderly (with something like Cās free(ā¦)): does nilex also free memory orderly, or does it cause a memory leak?
Thanks, Nelson