Beef
Beef copied to clipboard
[Bug] Append allocation results in falsely detected memory leak
In the following example the string that has been added to "MyList" will be detected as a memory leak after a few seconds eventhough it's not actually a leak. Replacing the append allocation with a "normal" allocation will not be detected as a leak.
class MyClass
{
List<String> MyList;
[AllowAppend]
public this()
{
let list = append List<String>();
MyList = list;
MyList.Add(new String("Hello"));
}
public ~this()
{
for(let str in MyList)
{
delete str;
}
delete:append MyList;
}
}
class Program
{
static int Main(String[] args)
{
MyClass c = new MyClass();
for(;;){}
delete c;
return 0;
}
}