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.
Unfortunately, activation email could not send to your email. Please try again.

BarItem event "Click" and memory leaks

Thread ID:





23555 Jan 14,2005 04:04 AM Jan 18,2005 07:16 AM Windows Forms 4
Tags: Tools
Asked On January 14, 2005 04:04 AM

Hello, I noticed that your menu does not free references to Form where it is placed. I Attached small sample. Please check. I Created MDI app with 2 forms: Parent(Form1) and Child(Form2) Form1 contains button for create and show Form2. Form2 contains Button for allocate memory and syncfusion tool bar with 1 button. How to test: 1. Open Windows Task Manager 2. Start app 3. Open Form2 4. Close form2 5 Repeate step 3,4 while program will explosion( about 5-6 times). OutOfMemeryException. So it does not free memory. OK. Now lets fix this problem. 1. Open Source code Form2.cs and comment line 109. like that // this.barItem1.Click += new System.EventHandler(this.barItem1_Click); 2.Compile app and run. 3. Repeate first test. 4. You will notice that it will free memory and you will never get OutOfMemeryException. Conclusion: When I subscribe to event "Click" of BarItem it reference to Form2. Then I close form and BarItem does not free reference to Form2 so GC can''t free memory of Form2 as it is referenced by BarItem. Regards, Slava. SyncMemoryLeak_3057.zip

Administrator [Syncfusion]
Replied On January 14, 2005 01:21 PM

Hi Slava, To prevent this problem you need to have an appropriately named Toolbar in your MainFrameBarManager. The Child needs a matching Toolbar to merge its BarItems into. You don''t need to populate this Toolbar with any BarItems, but it does need to be created by the MainFrameBarManager. I fixed the problem in your sample by creating a Toolbar named MainToolBar in Form1. I''ve run it through my own Memory Profiler and the memory appears to be freed now. Regards, Gregory Austin Syncfusion, Inc. SyncMemoryLeak_5240.zip

Replied On January 18, 2005 01:02 AM

Yes, it works. Thx. But I don''t like that idea. if application contains many child forms and every child form contains several toolbars then I must to create so many empty tool bars on the main form. does syncfusion plan to resolve this problem by another way? Regards, Slava.

Administrator [Syncfusion]
Replied On January 18, 2005 07:05 AM

Hi Slava, We''ve logged a QA report regarding this issue and are looking into it. Thank you for your patience regarding this matter. Regards, Gregory Austin Syncfusion, Inc.

Administrator [Syncfusion]
Replied On January 18, 2005 07:16 AM

The QA is #822. I apologize for the omission. Regards, Gregory Austin Syncfusion, Inc.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.