- Home
- Forum
- Xamarin.Forms
- When SfPopup is opened increase in memory usage
When SfPopup is opened increase in memory usage
Dear Team.
I hope all is well.
I am using "SfPopup" frequently while running my application, and it is registering a high RAM consumption. Every time the popup is opened, there is an increase in memory usage, and it never decreases through the garbage collector.
Could you tell me if there are any options that can avoid this from happening?
To reproduce what happens I have used the source code of Xamarin Demos (https://github.com/syncfusion/xamarin-demos) modifying two files of the "PopupLayout" project. I am attaching these so that you may review it.
I am also attaching a video where this effect is displayed.
Best,
Salva
Attachment: SfPopuphighmemoryusage_74ae51b9.7z
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
SS
Sivaraman Sivagurunathan
Syncfusion Team
July 29, 2020 04:22 PM UTC
Hi Salva,
Thanks for using Syncfusion controls.
Currently we are validating the reported issue from our side we will update the further details on or before 3rd August 2020. We appreciate your patience until then.
Regards,
Sivaraman S
SS
Sivaraman Sivagurunathan
Syncfusion Team
August 3, 2020 11:32 AM UTC
Hi Salva,
Thanks for your patience.
We have checked your query. in that, we need to clear the ContentTemplate content when we close the popup view. So that the old elements instance does not maintain. We have shown and close the popup view without the ContentTemplate at the time the process memory does not increases. We have attached the video for your reference. So you have to set the children as null in closed event in popup view.
Regards,
Sivaraman S
SR
Salva Rondan
August 10, 2020 10:07 AM UTC
Hi Sivaraman, I have assigned the content of the "Template" to null in the closed event, but I get the same result, it constantly increases the ram.
Could you tell me how to solve it?
I attach the modified "GettingStarted.xaml.cs" file.
Thank you.
Attachment: GettingStarted.xaml.cs_b07bafc3.7z
SS
Sivaraman Sivagurunathan
Syncfusion Team
August 11, 2020 01:08 PM UTC
Hi Salva,
Currently we are validating the reported issue from our side with your code snippet. we will update the further details on or before 14th August 2020. We appreciate your patience until then.
Regards,
Sivaraman S
SS
Sivaraman Sivagurunathan
Syncfusion Team
August 14, 2020 02:37 PM UTC
Hi Salva,
Thanks for your patience.
We have analysis the sample and We checked the memory leak by using the Performance profiler and we found there are only few objects which are related to SfPopupLayout are hold when come back to the normal page. we have load the CustomLabel inside the ContentTemplate. Check the object the custom label object, there no object related to CustomLabel.
Disposing PopupView and its related objects:
Each time when you close the popup using SfPopupLayout.IsOpen = false or SfPopupLayout.Dismiss(), we will automatically dispose all the native platform objects that we had created for showing the popup view. So you can be guaranteed that the popup view related objects are cleared each time you close the popup. In your case, you have opened and closed the popup view continuously, So that the Dignositc tool will show the high memory usage.
However, if the dispose implementation of the control loaded inside the popup view is faulty, or you want to dispose the unnecessary views when the popup is closed, that has to be dealt from the sample level in the SfPopupLayout.Closed event.
Disposing SfPopupLayout and its related objects:
The dispose for the SfPopupLayout instance and its contents will be triggered automatically once you exit the page that contains the SfPopupLayout. Else you can also call the SfPopupLayout.Dispose() wherever required. Any template view that you have loaded inside the SfPopupLayout needs to be disposed manually in the OnDisappearing() override of the page.
Please refer the below link to know more about the Performance profiling:
We have logged the bug report for few SfPopup object are hold. We will fix and include it in our upcoming volume 3 main release. which is expected to be rolled out at the end of September 2020.
You can also track the status of the report in below feedback link,
Regards,
Sivaraman S
Marked as answer
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
- Marked answer
-
SR Salva Rondan
- Jul 28, 2020 12:24 PM UTC
- Aug 14, 2020 02:37 PM UTC