kippthekidd

Leak in Mono WinForms

Apr 19th, 2011
44
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Windows.Forms;
  3. using System.Drawing;
  4.  
  5. static class Program
  6. {
  7.     static Form frm = new Form();
  8.  
  9.     [STAThread]
  10.     static void Main()
  11.     {
  12.         Timer tmr = new Timer() { Enabled = true };
  13.         tmr.Tick += new EventHandler(tmr_Tick);
  14.         Application.Run(frm);
  15.     }
  16.  
  17.     static void tmr_Tick(object sender, EventArgs e)
  18.     {
  19.         frm.Controls.Clear(); // <- These controls don't seem to get collected.
  20.         frm.Controls.Add(new Control() { BackgroundImage = new Bitmap(1024, 768) });
  21.     }
  22. }
RAW Paste Data