The issue was from the creation of ViewModel inside the view. I've tried a lot of things (set to null the ItemSource of items, use Binding, remove binding, just an empty view with an empty VM, change cache mode, and lot of others things)
And the issue was here. This is a way used in the community toolkit to do the instance of VM for a view :
public ListDetailsPage()
{
ViewModel = App.GetService<ListDetailsViewModel>();
InitializeComponent();
}
If you create the VM like this :
public ListDetailsPage()
{
ViewModel = new ListDetailsViewModel();
InitializeComponent();
}
The GC work properly and the view was released when the tab is removed from the TabView. I can't explain why (For the DI the VM is declared as usual). After a lot of test with dotMemory this is the day and night, with "new VM()" everythings work like a charm, with DI for the VM, each loaded view is never released by the GC.
I'm crazy, no doubt, but the result is just evident.