Open LGE-AUGMENSYS opened 3 years ago
Does it work fine if you are not using Syncfusion tab view ?
No. In our real application, it still leaks even if I remove the Syncfusion tab view. So I assume it has the same problem in some other containers. Due to our time pressure, I've only managed to recreate the issue using the tab view in the attached example.
We found out that if we explicitly call Dispose on the Image control, the leaks are gone. However, other controls seem to have the same problem. So it looks like certain containers have problems propagating the disposal? Or did the disposal mechanism (or the way view hierarchical tree is managed) change after Xamarin.Forms 4.6?
We found out that if we explicitly call Dispose on the Image control, the leaks are gone. However, other controls seem to have the same problem. So it looks like certain containers have problems propagating the disposal?
What other "containers" are you using?
No. In our real application, it still leaks even if I remove the Syncfusion tab view. So I assume it has the same problem in some other containers.
If I remove the tab view and just have the Image as the content of the Page, there is no leak. So your theory that it's container-dependent seems sound, but right now the only example we have is the Syncfusion Tab. So unless you can tell us of another type of container which causes this issue, I think this is a Syncfusion bug, not a Forms bug.
We found out that if we explicitly call Dispose on the Image control, the leaks are gone. However, other controls seem to have the same problem. So it looks like certain containers have problems propagating the disposal?
What other "containers" are you using?
No. In our real application, it still leaks even if I remove the Syncfusion tab view. So I assume it has the same problem in some other containers.
If I remove the tab view and just have the Image as the content of the Page, there is no leak. So your theory that it's container-dependent seems sound, but right now the only example we have is the Syncfusion Tab. So unless you can tell us of another type of container which causes this issue, I think this is a Syncfusion bug, not a Forms bug.
Other "containers" include mostly ContentView with dynamically loaded templates, Syncfusion list view, pull to refresh. I provided the example to Syncfusion and they claim to have fixed it (just the tab view, though). I am still waiting to see the fix.
However, one thing is also clear that the same setup (our app, Syncfusion controls) has no leaks in Forms 4.6 (details in the Basic Information section). Of course it could still be that some basic Forms concepts/APIs were misunderstood/misused and are now broken "as expected". I raised the same question to Syncfusion but unfortunately got no help.
I know it's a difficult ask, but I would really appreciate if you guys having more insights on the Forms version related changes could offer some hints or directions of thoughts.
So I finally got some free time to further compare the differences between our leaking app and the example. It turns out the leaks are only present in a Master-Detail page setup. I'm linking the modified example app below. FormsMemoryLeak.zip
My testing is done using Visual Studio's builtin profiler. From the start page of the app:
You can see there are exactly five additional instances of the TitlePage remaining. To summarize:
I hope this helps.
Description
When using the Xamarin.Forms Image control to display font glyphs inside a Syncfusion tab view, the entire pages are kept in memory, causing memory leaks.
Steps to Reproduce
Expected Behavior
No delta in the diff of live instances or at least no additional instances of the LeakPage and its associated instances.
Actual Behavior
Many new instances are kept in memory and cannot be GC'ed. See screenshots below.
Basic Information
Screenshots
Reproduction Link
FormsMemoryLeak.zip
Workaround
Downgrading Xamarin.Forms. However, our product release would be heavily affected by this.