Memleak when removing GLib.Object from list
The following code will produce a memory leak in Vala 0.48.18 and Vala 0.54.2
Expected behaviour: As the swag object inside the test method goes out of scope and it is not referenced by the list anymore, it should be freed.
Actual behaviour: The object is not being freed
This also works when placing the whole content of void test()
in the main method
public class Swag : GLib.Object {
public Swag() {
message("maded a swag");
}
~Swag() {
message("destructerizered a swag");
}
}
public static void test() {
var list = new GLib.List<Swag>();
var swag = new Swag();
list.append(swag);
list.remove(swag);
}
public static void main (string[] argv) {
test();
}