mppf1
1
18391, "mppf", "memory leak with uncaptured variable", "2021-09-10T15:30:22Z"
Summary of Problem
A particular pattern of code leaks memory when it should not. I've verified that this leak existed in 1.24.
Steps to Reproduce
Source Code:
// tt.chpl
class MyArgument {
var x: int;
}
record myParser {
var y: int;
}
proc myParser.addHandler(i: int) throws {
return new shared MyArgument(i);
}
proc callAddHandler(ref parser) throws {
// does not leak
//var tmp = parser.addHandler(1);
// leaks
parser.addHandler(1);
}
proc main() {
try! {
var parser = new myParser();
// does not leak
//parser.addHandler(1);
// leaks
callAddHandler(parser);
}
}
Compile command:
chpl tt.chpl
Execution command:
./tt --memLeaks
Associated Future Test(s):
none yet