2

Closed

Closed documents not released for garbage collection

description

If I run the Window4.xaml sample from the avalondock-45809 build and perform the follow steps.
 
  1. Click Add Documents (Adds 5 DemoDocuments to bound Observable collection)
    • take memory snapshot using .Net Memory Profile verify 5 instances of DemoDocument
       
  2. Close Document 0 via the context menu)
    • take memory snapshot using .Net Memory Profile verify 5 instances still remaining of DemoDocument
       
  3. Subsequent closes result in removal of instances of DemoDocuments as expected, so that when I have removed all 5 DemoDocuments, I still have 1 Instance remaining.
     
  4. Click Add document a second time
    • take a memory snapshot using .Net Memory Profile, now I have 6 instances of DemoDocument in memory but only 5 in view
       
      I can do this repeatedly and app will continue to use up memory

file attachments

Closed May 22, 2013 at 4:47 PM by emartin

comments

GeertvanHorrik wrote Jul 15, 2010 at 8:15 AM

For the moment, you can call GC.Collect() and the memory will be collected. However, that is not something you should do manually.

aingoppa wrote Feb 17, 2012 at 2:09 AM

This happens with recent 1.3.3600 build too. I tested included Sample1 with x86 build. In the example,
  1. Click "New" to open new document.
  2. Click "X" to close the document.
  3. Using windbg.exe, sos and sosex, I figured out that,
    Maindow.dockingManager._mainDocumentPane._effectiveValues[??].ModifiedValue._baseValue has reference to the closed document.
ESP:58dee98:Root: 024b256c(System.Threading.Thread)->
024c02c0(System.Threading.ExecutionContext)->
024bfe64(System.Windows.Threading.DispatcherSynchronizationContext)->
024bfc60(System.Windows.Threading.Dispatcher)->
0253c958(System.Windows.Input.InputManager)->
0253cf80(System.Windows.Input.StylusLogic)->
0253d0b8(System.Collections.Generic.Dictionary2[[System.Object, mscorlib],[System.Windows.Input.PenContexts, PresentationCore]])->
0253d104(System.Collections.Generic.Dictionary
2+Entry[[System.Object, mscorlib],[System.Windows.Input.PenContexts, PresentationCore]][])->
02618a4c(System.Windows.Interop.HwndSource)->
0253c1e0(Sample1.MainWindow)->
0257a200(AvalonDock.DockingManager)->
0257d644(AvalonDock.DocumentPane)->
02766a6c(System.Windows.EffectiveValueEntry[])->
027b1588(System.Windows.ModifiedValue)->
02682334(Sample1.Document)


GC.Collect() does not release & collect the document.

FYI, I attached the full referenced tree. You may open the reference tree in VS.

wrote May 22, 2013 at 4:47 PM

Old or obsolete issue. Please ask for reopen if needed in version 2.0