System.Windows.Forms.Control based classes are not collected in CF
Hello,
I'm not able to figure out how to collect/ dispose classes based on
System.Windows.Forms.Control. Under Windows CE the memory will fill up until
i get an out of memory exception. On my PC everything works fine. I'm running
Windows CE 5.
What can I do?
Thanks,
Armin
Code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Garbage
{
public class GoodGarbage
{
private byte[] m_Memory;
public GoodGarbage()
{
m_Memory = new byte[8196];
}
~GoodGarbage()
{
}
}
public class BadGarbage : System.Windows.Forms.Control
{
private byte[] m_Memory;
public BadGarbage()
{
m_Memory = new byte[8196];
}
~BadGarbage()
{
}
}
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[MTAThread]
static void Main()
{
while (true)
{
GoodGarbage gg = new GoodGarbage();
BadGarbage bg = new BadGarbage();
if (bg is IDisposable)
(bg as IDisposable).Dispose();
System.Threading.Thread.Sleep(1);
}
}
}
}
Date:Wed, 25 Jul 2007 22:22:01 -0700
Author:
|