Compact classes can silently leak memory
@mpiechotka
Submitted by Maciej Marcin Piechotka Link to original bug (#695050)
Description
Consider following case:
[Compact]
class LeakMemory<G>
{
G g;
}
LeakMemory<Gtk.Widget>? lm = new LeakMemory<Gtk.Widget>(); lm.g = new Gtk.Window(); lm = null; // lm.g memory is freed, right?
Proposed solution:
- Add warning for old-style generics that contains generic fields
- Add attribute [GenericDtor] or similar (possibly [GenericMethods] as well) which allows to pass the generic attributes via arguments rather then store in class.