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
ViewModel
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
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