sfDatagrid avoid destruction from ViewModel in UWP (possible memory leak)

Hi
In our Application we creting and destroying dynamic views with ViewModels.
1) I have a ListView that ItenSource is binded to a list in the VM => the destructor from the VM will call proper
2) I have also a SfDataGrid on the same view binded to the same VM and Itemsource => destructor is never called.

reproduce:
Download attached example
compile and runn
take a look to the output window:
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
Stop application
open file View1.xaml 
uncommnt line 30 ()
recompile and start application
take look to Output window
+++ VM Created +++
GC called
+++ VM Created +++
GC called
+++ VM Created +++
GC called
+++ VM Created +++
GC called
+++ VM Created +++
GC called

You see the distructer will never be called.

You can see it on Diagnostic tool too after 10 times creating and destroing View1 withot sfDataGrid  there are only 1 instance of View1ViewModel in memory using sfDatagris there are 10 !

some more info:

using sfDatagrid and test it with the  PerformanceProfiler only one instance of  View1ViewModel is in memory ! Compiling to release mode also looks better. It could be that the issu happends only in debug mode. Anyhow we are developing an kiosk app running 7/24 and memory consumption are very important for us


Wolfgang



Double posted, see https://www.syncfusion.com/support/directtrac/incidents/197487





Attachment: TestSfDataGrid_51197b96.zip

1 Reply

SS Sivaraman Sivagurunathan Syncfusion Team January 30, 2018 03:41 AM UTC

Hi Wolfgang, 
 
Thank for using Syncfusion support. 
 
We have checked the reported “ViewModel destructor is never called while using CustomView ”issue and we are able to reproduce the same issue with simple customview with ListView. We have reported this issue in Bugzilla, please find the Bugzilla report in below.  
  
 
Regards, 
Sivaraman 


Loader.
Up arrow icon