Memory leak when repeatedly auto-hiding then docking ToolWindow in RadDock with data-binding

5 posts, 0 answers
  1. Eljay
    Eljay avatar
    10 posts
    Member since:
    Dec 2011

    Posted 18 Jan 2012 Link to this post

    Hey Telerik,

    I've discovered a memory leak issue when repeatedly auto-hiding then docking a ToolWindow in a RadDock.

    I'm designing an application using the MVVM design pattern with a basic View and View-Model. The View is a form that contains a RadDock with a ToolWindow, and data-binding setup to the ToolWindow's property "DockState." The View-Model contains the bound property "ToolWindow1DockState" that uses INotifyPropertyChanged to update the ToolWindow's property "DockState". Below is my code, attached is my View's designer.

    View
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using RadDockMemoryTest.ViewModel;
     
    namespace RadDockMemoryTest.View
    {
        public partial class Form1 : Form
        {
            private MainViewModel viewModel;
            /// <summary>
            /// View Model object
            /// </summary>
            public MainViewModel ViewModel
            {
                get
                {
                    if (viewModel == null)
                    {
                        ViewModel = new MainViewModel();
                    }
                    return viewModel;
                }
                set { viewModel = value; }
            }
             
            /// <summary>
            /// Form default constructor
            /// </summary>
            public Form1()
            {
                InitializeComponent();
            }
     
            /// <summary>
            /// Form load event handler
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void Form1_Load(object sender, EventArgs e)
            {
                setupControlBindings();
            }
     
            /// <summary>
            /// Setup window's control bindings
            /// </summary>
            private void setupControlBindings()
            {
                radDock1.DockWindows["toolWindow1"].DataBindings.Add("DockState", ViewModel, "ToolWindow1DockState", true, DataSourceUpdateMode.Never);
            }
        }
    }

    ViewModel
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Telerik.WinControls.UI.Docking;
     
    namespace RadDockMemoryTest.ViewModel
    {
        public class MainViewModel : ViewModelBase
        {
            private DockState toolWindow1DockState;
            /// <summary>
            /// Controls toolWindow1's dock state
            /// </summary>
            public DockState ToolWindow1DockState
            {
                get { return toolWindow1DockState; }
                set
                {
                    toolWindow1DockState = value;
                    OnPropertyChanged("ToolWindow1DockState");
                }
            }
        }
    }

    I setup a Window's automation tool to execute the following sequence:
    1. Click "Auto-hide" on the docked ToolWindow.
    2. Click the ToolWindow tab.
    3. Click "Docked" to restore the ToolWindow to its docked state.

    After letting the automation run overnight and observing memory processes in Windows Task Manager, I noticed the application's memory usage jumped from 32,000KB to 800,000KB.

    How can I avoid the memory leak?

    Thanks,
    Eljay
  2. Eljay
    Eljay avatar
    10 posts
    Member since:
    Dec 2011

    Posted 18 Jan 2012 Link to this post

    I forgot to add that when the application hit 800,000KB, minimizing the application caused it to crash.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 20 Jan 2012 Link to this post

    Hi Eljay,

    Thank you for reporting this issue. In our latest release - Q3 2011 SP1 we addressed several issues related with memory leaks including one related with RadDock. Our tests do not indicate further memory leaks in RadDock. We always take serious such issues and that is why we want to investigate this one further. Could you, please send us your test application. This will help us to locate any potential issue faster and to ensure that this issue will be addressed in our upcoming release in February. Thank you in advance.

    I am looking forward to your reply.

    Regards,
    Jack
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

  5. Eljay
    Eljay avatar
    10 posts
    Member since:
    Dec 2011

    Posted 20 Jan 2012 Link to this post

    Hey Jack,

    I'm running RadControls for WinForms Q3 2011 SP1. How can I send my application to Telerik?

    Thanks,
    Eljay
  6. Eljay
    Eljay avatar
    10 posts
    Member since:
    Dec 2011

    Posted 20 Jan 2012 Link to this post

    Ignore my latest post. I entered a support ticket with a .zip file attached containing my application.

    http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=503696
Back to Top
UI for WinForms is Visual Studio 2017 Ready