Memory Leak using DateTimePicker?

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 14 years ago by Bill Boland - Software Engineer, CME, Inc for Thomson Elite
Version: 9.1.0503
Platform: .NET 3.5
Environment: Windows 7 (32-bit)
Avatar
We have been doing some performance and memory profiling of our application. It uses the DateTimePicker control from the WPF Studio(2009.0503). The RedGate ANTS Memory Profiler reports that windows that have a DateTimePicker control on them are not being reclaimed when closed. This causes a memory leak.

To isolate this, we created a simple WPF/.NET application that opens a window with only a single DateTimePicker control on it and then perform the memory profiling taking snapshots before opening the window, when the window is opened, and after closing the window. The profiling results from the last snapshot (compared with the first, basline snapshot) show that the window is still retained in memory.

We have documented the reference chain as reported by the ANTS Memory Profiler (see below). We also tried this with the latest version (2010.0521) and the same reference chain prevents the window from being reclaimed. If we remove the DateTimePicker from the window (essentially an empty window), the window is reclaimed as expected. So the simple inclusion of the DateTimePicker control seems to prevent the window from being reclaimed.

We can provide additional details and the sample application. Any assistance would be appreciated as the DateTimePicker control is used extensively on windows and the windows sometime hold references to large amounts of data that is not being reclaimed.

Reference Chain preventing window from being reclaimed
Finalizer Queue --> System.Windows.Documents.TextEditor _uiScope --> System.Windows.Controls.TextBox (this as DependencyObject)._effectiveValues --> System.Window.EffectiveValueEntry[] --> ActiproEditorMemoryLeak.WindowWithDateTimePicker


WindowWithDateTimePicker.xaml

<Window x:Class="ActiproEditorMemoryLeak.WindowWithDateTimePicker"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WindowWithDateTimePicker" Height="300" Width="300" xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared">
    <Grid>
        <shared:DateTimePicker Height="23" Margin="38,72,60,0" Name="dateTimePicker1" VerticalAlignment="Top" />
    </Grid>
</Window>

Comments (8)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bill,

I just made a test application that has a Window and opens the Window you indicated. We use the profiler at memprofiler.com to do this sort of testing. After I closed the window with the DateTimePicker on it, I saw that both the child Window and the DateTimePicker were released properly from memory. Their instance count and memory usage both went back to zero.


Actipro Software Support

Posted 14 years ago by Bill Boland - Software Engineer, CME, Inc for Thomson Elite
Avatar
I appreciate you quick response. Maybe we are in need of profiling profilers here! I will try my sample application with this profiler and let you know of our results.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hehe... we were just saying that here too. :) Ok and if you see something other than what we saw, maybe ZIP up your small demo (without any .exe files) and email that over.


Actipro Software Support

Posted 14 years ago by Robert A. McCarter
Avatar
I'm also seeing memory errors with the date-time picker, and the animated expander. I'm using JetBrain's dotTrace Memory 3.5.

I suspect that both are related to the use of animations.

When I remove the ActiPro animated expander and use a normal WPF Expander the memory leak problem immediately disapears.

Additionally (if this helps) I am using these controls in an Actipro docking tool-window. When the user selects a new item in the main document, the tool-window contents will change and that's when the memory-leak occurs.

Robert
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Robert,

We tried various combinations and were unable to reproduce it. Could you please put together a small sample project that reproduces the issue and email it over to our support address? Be sure to remove any executables from the zip archive or rename the extension.


Actipro Software Support

Posted 14 years ago by Robert A. McCarter
Avatar
Were you using VS2008/.NET 3.5SP1 or VS2008/.NET 4?
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Robert,

We tested it in our Sample Browser using Visual Studio 2010, but targeting .NET 3.5 SP1.


Actipro Software Support

Posted 14 years ago by Robert A. McCarter
Avatar
I'll try and put together a small sample.
The latest build of this product (v24.1.2) was released 3 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.