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

BarItem event "Click" and memory leaks

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

4 Replies

Administrator January 14, 2005 06:21 PM UTC

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

SI Silenter January 18, 2005 06:02 AM UTC

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 January 18, 2005 12:05 PM UTC

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 January 18, 2005 12:16 PM UTC

The QA is #822. I apologize for the omission. Regards, Gregory Austin Syncfusion, Inc.
Loader.
Live Chat Icon For mobile
Up arrow icon