Memory leak when closing rafted window

Docking/MDI for WPF Forum

Posted 12 years ago by Samuele Gantner
Version: 12.1.0561
Platform: .NET 4.0
Environment: Windows 7 (64-bit)


we found a memory leak with the following repro steps:

  1. Start the app
  2. Add a document window to a dock site
  3. Raft the tab
  4. When the tab is rafted, close it

In this image, you can see a memory state taken after step 4. The sample app I prepared opens a DocumentWindow containing a simple user control (MyControl). As you can see in the image the window containing the control is still being referenced by TabbedMdiHost after closing it.

Please note that if, after step 4, you create another tab, then the previously referenced DocumentWindow is removed and can be garbage collected. However we cannot suppose users will always keep opening new tabs, so in practice this is indeed a memory leak.

Also note that with the following steps

  1. Start the app
  2. Add a document window to a dock site
  3. Close it

The problem does not repro. So it's really somehow related to rafting.

I would be glad to provide the sample app the the full ANTS profiling data (but I couldn't find a way to upload content in this forum)


Comments (2)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Sam,

Thanks for reporting this.  We've fixed it for the next maintenance release.  Basically it was still holding the ref to that window in its PrimaryWindow property.  So as soon as you would open/select/close another document in the MDI, it would drop that ref anyhow.

Actipro Software Support

Posted 12 years ago by Samuele Gantner

Fantastic, thank you very much for the quick reply and resolution!

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.