We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Docking Manager memory leak

Hi,
I am programming with c# visual studio 2005 and syncfusion 4.4

I Create DockingManager and insert to there a form.
for remove the form from the DockingManager i write the next code:

m_DockingManager.EnableDock(myForm, false);
myForm.Parent = null;

This code remove the form from the controlsArray in the DockingManager but when i run the .net memory profiler to check if the form is really release from the memory,i discoverer that the DockingManager still holding the form in inner hashtable.bucket[] member.

how i absolutely remove the form from the docking manager?

Thanks,
Yuval

8 Replies

GR Golda Rebecal Syncfusion Team September 1, 2007 12:48 PM UTC

Hi Yuval,

Sorry for the delay in responding.

I am afraid that I am not able to reproduce the issue you have mentioned. Please refer to the sample that I used to test this issue and .NET profiler result available in the link given below:
http://websamples.syncfusion.com/samples/Tools.Windows/F67761/main.htm

In the attached sample, I have removed a form from the DockingManager in a ButtonClick event. I checked it in .NET profiler and I could not find the issue you have mentioned.

Could you please provide a sample having the issue? This will help us to resolve the issue soon.

We appreciate your interest in Syncfusion products.

Best regards,
Golda


YZ Yuriy Zubarev September 2, 2007 07:54 PM UTC

I was reporting memory leaks since early versions of Essential Tools at least two years ago and Syncfusion never addressed the issue. I don't believe they ever will.


YU Yuval September 3, 2007 05:12 PM UTC

Thank you on the answer!

This code is casued to the memory leak:

public class Form1 : Form
{
UserControl uc;

public Form1()
{
// In the initializeComponenet i add a DockingManager class and 2 button
InitializeComponenet();

uc = new UserControl();
}

// Add UserControl to the docking manager
private void button1_Click(object sender, EventArgs e)
{
// The paramters for the rectangle doesn't matter
Rectanagle rec = new System.Drawing.Rectangle(200, 200, 200, 100);

dockingManager1.FloatControl(uc, rec);
dockingManager1.DockControl(uc, this, DockingStyle.Tabbed, 200);

// This 2 rows is caused the memory leak, without this rows the uc is relese from the memory
dockingManager1.SetDockAbility(uc, DockAbility.None);
dockingManager1.SetOuterDockAbility(uc, DockAbility.None);
}

// Remove User Control From the docking manager
private void button2_Click(object sender, EventArgs e)
{
dockingManager1.SetEnableDocking(uc, false);
uc.Parent = null;
uc = null;
}

}



thanks,
yuval


MS Mohamed Suhaib Fahad A. Syncfusion Team September 6, 2007 02:05 PM UTC

Hi Yuval,

Sorry for the delay.

I have identified the memory leak is in DockStateControllerWrapper is not getting disposed when the object closes. I have filed a defect report for this. This would be analysed so that there are no code breaks and fixed appropriately.

The architecture of DockingManager is very big, we are working up on cleaning up all the unwanted objects that stays there in the memory. However, in our future releases we expect each product to be cleaned up from memory leaks.

Please let me know if you want any more details.

Regards,
Fahad


AM Ampelio April 22, 2008 03:28 PM UTC

>The architecture of DockingManager is very big, we are working up on cleaning up all the unwanted objects that stays there in the memory. However, in our future releases we expect each product to be cleaned up from memory leaks.

Considering that the Memory Leaks problems are still present in 6.2.x.x, what do you mean "exaclty" when you say "in our future releases we expect each product to be cleaned up from memory leaks"?



AD Administrator Syncfusion Team May 10, 2008 01:14 AM UTC

I confirm this is still happening in 6.2 also;
Seems to affect any MDI child form.

Using tabbed mdi.

I am not seeing it referenced by a DockingStateControllerWrapper; it appears to be referenced as a key of one of DockingMananger's private hashtables.





AD Administrator Syncfusion Team May 10, 2008 01:51 AM UTC

If you add this derived class:
internal class DockingManagerExtended:Syncfusion.Windows.Forms.Tools.DockingManager
{
public DockingManagerExtended():base()
{
}
public DockingManagerExtended(System.ComponentModel.IContainer container)
: base(container)
{
}

public void PurgeControlReference(Control ctrl)
{
this.SetEnableDocking(ctrl, false);
// Remove the control from the extended property hashtables
if (this.htText.Contains(ctrl)) this.htText.Remove(ctrl);
if (this.htIcon.Contains(ctrl)) this.htIcon.Remove(ctrl);
if (this.htFloatOnly.Contains(ctrl)) this.htFloatOnly.Remove(ctrl);
if (this.htHiddenOnLoad.Contains(ctrl)) this.htHiddenOnLoad.Remove(ctrl);
if (this.htAllowFloating.Contains(ctrl)) this.htAllowFloating.Remove(ctrl);
if (this.htCustomCaptionButtons.Contains(ctrl)) this.htCustomCaptionButtons.Remove(ctrl);
if (this.htDockAbility.Contains(ctrl)) this.htDockAbility.Remove(ctrl);
if (this.htOuterDockAbility.Contains(ctrl)) this.htOuterDockAbility.Remove(ctrl);

}
}



and call that method on the dispose event of the child forms; it seems to release the references.
In my app, it seems that htAllowFloating was always culprit



CG Cyril George August 19, 2011 06:08 PM UTC

Perfect Syncfusion -- way to go!
This issue exists in 9.1 too.


Loader.
Live Chat Icon For mobile
Up arrow icon