I've noticed a memory leak when I add "RestrictInContainer = true" to my XamWebDialogWindows. Disabled, everything gets garbage collected as it should; enabled, though, the control appears to remain subscribed to some SizeChanged events:
0:022> !gcroot 07726064 Note: Roots found on stacks may be false positives. Run "!help gcroot" formore info.Scan Thread 4 OSTHread 17a0Scan Thread 8 OSTHread 188cScan Thread 9 OSTHread 2c8Scan Thread 10 OSTHread 17b0DOMAIN(0CC4B488):HANDLE(Pinned):10712f8:Root: 0823d660(System.Object[])-> 072cbf70(System.Windows.Controls.Grid)-> 07787a18(System.Windows.SizeChangedEventHandler)-> 0773b1f0(System.Object[])-> 07730998(System.Windows.SizeChangedEventHandler)-> 07726064(StaffTrak.Silverlight.SilverlightMessageBox)
I tried setting RestrictInContainer to false before removing the dialog from the containing grid, but that doesn't seem to have any effect.
Can you verify this memory leak?
Hello Jason,
I have tried to reproduce this issue when I add the “RestrictInContainer = true" to XamWebDialogWindow and I couldn’t manage to get any memory issue. Can you give me more details and sample project in order to reproduce this on my side.
Thank you.
Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
The memory issue I'm noticing is because of the complex visuals we're using in the windows; currently the memory usage increases by 20mb with each window I open, which isn't itself a problem. I think the root of the problem is that XamWebDialogWindow is unable to be garbage collected, so this memory is never released.
I tried to create a sample project utilizing RestrictInContainer, but I was actually never able to GC the windows, regardless of the setting. How is one supposed to manage the lifetime of a XamWebDialogWindow? I add it as a child to a panel somewhere, and remove it from the panel when the window state changes to Hidden. Shouldn't this be enough?
Reusing one window isn't possible because the user may have any number of windows open simultaneously; they must be garbage collected.