OK. Long time no see. :)
I've been too busy to reply your thread.
First off, I'm a big fan of .NET Framework. So I've already understood the knowledge of the link "http://weblogs.asp.net/pwilson/archive/2004/02/14/73033.aspx"
But, You missed an important thing!
GC manages its own heaps, and allocates .NET Objects there, however its heaps are allocated as private bytes, which can be monitored by Task Manager.
Let me show an example of memory leak by using Actipro DockSite.
This sample code is very simple as follows,
<Window x:Class="WpfApplication2.Window1"
xmlns:docking="clr-namespace:ActiproSoftware.Windows.Controls.Docking;assembly=ActiproSoftware.Docking.Wpf30"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<docking:DockSite Name="applicationViewSite">
<docking:SplitContainer>
<docking:Workspace>
<docking:TabbedMdiHost />
</docking:Workspace>
<docking:ToolWindowContainer>
<docking:ToolWindow Title="Tool Window 1">
<Button Click="Button_Click">
<TextBlock TextWrapping="Wrap">Do test!</TextBlock>
</Button>
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:SplitContainer>
</docking:DockSite>
</Window>
public void Button_Click(object sender, RoutedEventArgs e)
{
while (true)
{
ToolWindow toolWindow = new ToolWindow(this.applicationViewSite);
toolWindow.Title = "Test";
toolWindow.Content = new UserControl();
toolWindow.MoveToMdi();
toolWindow.Activate(true);
applicationViewSite.Documents[0].Content = null;
applicationViewSite.Documents[0].Close();
}
}
After building, then execute this sample and press the button titled 'Do test!'.
As you can see, this sample do nothing, except of adding and removing dummy UserControl in the DockSite.
Performance monitor tools have shown the result,
[Figure 1. Memory leak to 1.2GB]
http://www.sysnet.pe.kr/syswebres/bbs/actipro_dock_site_mem_leak_1.png
[Figure 2. Memory leak to 1.5GB]
http://www.sysnet.pe.kr/syswebres/bbs/actipro_dock_site_mem_leak_2.png
[Figure 3. Memory leak to 1.7GB]
http://www.sysnet.pe.kr/syswebres/bbs/actipro_dock_site_mem_leak_3.png
Now, imagine the next [Figure 4].
If you are right, memory has to be fallen and risen again and again. At least the sample applicaion must not be exited.
unfortunately,
[Figure 4. Out-of-memory]
http://www.sysnet.pe.kr/syswebres/bbs/actipro_dock_site_mem_leak_4.png
What do you think? This application has no memory leak?
*** The web site "www.sysnet.pe.kr" will be running at KST 9:00 ~ 24:00.
[Modified at 07/12/2009 07:42 PM]
[Modified at 07/12/2009 07:43 PM]