We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Behaviours causing objects to stay in memory (memory leak)

Thread ID:

Created:

Updated:

Platform:

Replies:

145972 Jul 16,2019 10:02 AM UTC Feb 21,2020 01:18 PM UTC Xamarin.Forms 32
loading
Tags: SfRotator
Mark
Asked On July 16, 2019 10:31 AM UTC

Hi,

I am using a rotator to display pages. I have a check box that increments a number by 1 when ticked.

If I insert a page into the rotator the number is incremented twice in UWP and more in Android and iOS. The Android and iOS problem might be related to this.

I have done a ton of research and it looks like the behaviour (event) attached to the check box is still attached to the discarded objects and is preventing the garbage collector from removing them from memory.

On my EventToCommandBehavior class DeregisterEvent is never called.

Is there any way I can fix this?

Attached is a sample project that shows the problem.

Follow the following steps:

1. Run the UWP app and press start.
2. Tick and untick option 1. Note the growth value changes from 0 to 1 and back to 0.
3. Press Insert Page and note that a green page has been inserted.
4. Go back to page 1 and tick and untick option 1. Note the growth value changes from 0 to 3 and back to 0.
5. If you insert another page the growth value changes from 0 to 7 and back to 0.
6. If you now press the "Add 1 to Total" it adds 1 and works correctly.

Attached is a sample project with the latest NUgets.

Thanks

Mark.


Attachment: FreshMVVMSFDataGrid_3e70f757.zip

Mark
Replied On July 22, 2019 06:25 AM UTC

Morning.

Did this one get missed?

Looking forward to your reply.

Thanks

Mark.

Muneesh Kumar G [Syncfusion]
Replied On July 22, 2019 11:16 AM UTC

Hi Mark,  
 
We were able to reproduce the issue “CheckBox control not getting disposed when used inside Rotator” and we confirm this as a bug and logged a defect report. You can keep track of the bug from the feedback portal below. 
  
  
The fix for the reported issue will be available on our upcoming Vol 2 SP 1 release, which will be scheduled on end of August 2019.  
 
If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal. 
 
Regards, 
Muneesh Kumar G. 


Mark
Replied On July 22, 2019 12:00 PM UTC

Thank you.

Muneesh Kumar G [Syncfusion]
Replied On July 22, 2019 12:58 PM UTC

Hi Mark,   
 
Please let us know if you have any other queries.  
 
Regards,
Muneesh Kumar G. 
 
 


Mark
Replied On August 26, 2019 01:54 PM UTC

Hi,

Can you please give me an update on this?

Thanks

Mark.

Muneesh Kumar G [Syncfusion]
Replied On August 27, 2019 06:29 AM UTC

Hi Mark,    
  
Due to some stability concern, we have not moved the fix in our Vol 2 SP 1 release. But now we have fixed that issue and tested with all the cases. This fix will be available in our next weekly release, which will be available on September 3rd, 2019. We appreciate your patience until then.  
  
Regards,
Muneesh Kumar G. 
  
 


Muneesh Kumar G [Syncfusion]
Replied On September 3, 2019 02:04 PM UTC

Hi Mark,  
  
We glad to announce that our weekly NuGet packages(17.2.0.49) has been published in nuget.org(https://www.nuget.org/). 
  
Thanks,  
Muneesh Kumar G  
 


Mark
Replied On September 5, 2019 07:10 AM UTC

Hi,

I have just updated my test project and it is not fixed. Did the fix make it into the latest round of Nuget packages?

Attached is my test project that is fully updated as of today.

Thanks

Mark.

Attachment: FreshMVVMSFDataGrid_4934d67a.zip

Muneesh Kumar G [Syncfusion]
Replied On September 5, 2019 10:49 AM UTC

Hi Mark,

 
We have analyzed your application and we would like to inform you that we have fixed the reported problem in generic scenario and included the fix in our weekly release.  
 
But in your sample the same problem reproduced in some specific scenario, also the same problem reproduced with native CheckBox also.  
 
However, we have fixed this problem in your application by removing available behavior as per the below code snippet.

 
 
Template property: 
 
 
        public StackLayout Template 
        { 
            get 
            { 
                if (_template != null) 
                    RemoveBehaviors(_template); 
                _template = CreateTemplate(this); 
                return _template; 
            } 
            set 
            { 
                _template = value; 
            } 
        } 

RemoveBehavior method:
        
 
 /// <summary> 
        /// Removes behavior of child view if any 
        /// </summary> 
        /// <param name="parent"></param> 
        private void RemoveBehaviors(Xamarin.Forms.View parent) 
        { 
            if (parent != null) 
            { 
                parent.Behaviors.Clear(); 
                var viewGroup = parent as Xamarin.Forms.Layout<Xamarin.Forms.View>; 
                var contentView = parent as ScrollView; 
                if (viewGroup != null) 
                { 
                    foreach (Xamarin.Forms.View view in viewGroup.Children) 
                        RemoveBehaviors(view); 
                } 
                else if (contentView != null) 
                { 
                    contentView.Content.Behaviors.Clear(); 
                    RemoveBehaviors(contentView.Content); 
                } 
            } 
        } 
 
 

The previous given sample with the above-mentioned code changes can be downloaded from the below link.

 
 
Thanks,   
Muneesh Kumar G   
 


Mark
Replied On September 5, 2019 12:29 PM UTC

Hi,

Thank you for the fix. I will test it shortly.

Will your generic bug fix in the latest Nuget be modified to cover my scenario as well?

Your fix is a hack I would not like to use it in production. I would prefer that you fix the problem and release it properly.

Thanks

Mark.

Sakthivel Palaniyappan [Syncfusion]
Replied On September 6, 2019 01:51 PM UTC

Hi Mark, 
 
Sorry for the inconvenience caused. 
 
We will analyze further regarding the issue and we will integrate the workaround solution in our source to fix in source level in our Volume 3 2019 release which will be by the end of this September 2019 
 
Thanks, 
Sakthivel P. 


Mark
Replied On September 6, 2019 02:01 PM UTC

Thank you.

Ruba Shanmugam [Syncfusion]
Replied On September 9, 2019 12:48 PM UTC

Hi Mark,

We will let you know once fix is released in volume 3 2019. We appreciate your patience until then.

Regards,
Ruba Shanmugam

Taahir
Replied On November 21, 2019 08:07 AM UTC

Hi,

Has this fix been released?

Thanks.

Emil
Replied On November 23, 2019 07:29 PM UTC

was that fixed? 
is it memory leak related sfrotator or checkbox control? if i dont use checkbox control, does it still cause memory leak?

Hemalatha Marikumar [Syncfusion]
Replied On November 25, 2019 10:25 AM UTC

Hi Emil & Taahir, 
 
Thanks for your update. 
 
We would like to let you know that the reported memory leak issue with Xamarin.Forms UWP platform has been fixed with our latest nuget version (17.3.0.28). 
 
Please check and let us know if you have any other concern. 
 
Regards, 
Hemalatha M. 


Hemalatha Marikumar [Syncfusion]
Replied On November 25, 2019 10:26 AM UTC

Hi Emil & Taahir, 
 
Please ensure that with clearing the nuget cache as per in below guidelines 
 
 
Regards, 
Hemalatha M. 


Mark
Replied On November 26, 2019 09:27 AM UTC

Hi,

I tested in UWP (fixed) but Android is even worse now.

In Android on the first click it shows 3 and when you add another page it shows 6.


Attached is an updated project showing the problem. The hack still works though but I would prefer this to be fixed properly.

Thanks

Mark.


Mark
Replied On November 26, 2019 09:29 AM UTC

Here the project... Please test your fix on UWP, Android and iOS.


Attachment: FreshMVVMSFDataGrid_6a5d5ed.zip

Hemalatha Marikumar [Syncfusion]
Replied On November 28, 2019 02:01 PM UTC

Hi Mark,   
 
Sorry for the Inconvenience caused. 
 
Currently we are working on fixing the issues with Android and iOS related with cases on the provided sample and you can keep track of the bug from the feedback portal below.  
 
The fix for the reported issue in Android and iOS platform will be included in our upcoming Volume 4 2019 release, which will be scheduled by the mid of December 2019.   
 
If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal. 
 
Regards, 
Hemalatha M. 


Hemalatha Marikumar [Syncfusion]
Replied On January 7, 2020 12:48 PM UTC

Hi Mark, 
  
Sorry for the inconvenience caused. 
   
We have fixed the issue of SfCheckBox in SfRotator on Android and UWP platforms. As per the current behavior, we have reduced the count of CheckBox rendering into dual value. We will check this as like in Android & UWP with maximum possibilities, if possible, we have included the changes in any of our upcoming weekly release. 
 
We appreciate your patience until then. 
 
Regards, 
Hemalatha M. 


Mark
Replied On January 13, 2020 10:18 AM UTC

Hi,

Thank you for trying to fix this. Is is still not working. It appears you did not test with the sample project as we are spinning our wheels here. Before the next fix is released please test with this sample project. I have updated all Nugets to latest versions.

Just to confirm the expected result: When I click "Option 1" I expect The Growth value to show "1" no matter how many pages(templates) are added.

The results are as follows:

UWP: Correct.
     Initially the value shows 1/0 when I click/unclick "Option 1" . This is correct.
     Once a template is added it still shows 1/0 when I click/unclick "Option 1". This is correct.

Android: Incorrect.
     Initially the value shows 2/0 when I click/unclick "Option 1" .. This is wrong.
     Once a template is added it still shows 1/0 when I click/unclick "Option 1". This is correct.

iOS: Incorrect.
     Initially the value shows 1/0 when I click/unclick "Option 1" . This is correct.
     Once a template is added  the value shows 2/0 when I click/unclick "Option 1". This is wrong.

Please fix this and use the supplied test project to confirm that it is fixed.

Thanks

Mark.



Attachment: FreshMVVMSFDataGrid_4a9c35d8.zip

Hemalatha Marikumar [Syncfusion]
Replied On January 14, 2020 11:57 AM UTC

Hi Mark,

Thanks for your update.

We have analyzed your query and we were unable to reproduce the issue in Xamarin.Forms Android, for that we have recorded video, please find the video from below location.

Video link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/Rotator_memory-1587585523.zip

Currently we are working on the reported issue on iOS, we will update once the fix is included in weekly release. 
 
Regards, 
Hemalatha M. 


Mark
Replied On January 15, 2020 09:00 AM UTC

Hi,

Your video shows the correct behavior. I unfortunately cannot duplicate that.

I don't see the same result in Android. I have tested in a Genymotion emulator and my physical Nokia 8 device. I have also tested on my laptop (second dev machine).

Attached is a video of what I see.... As you can see the first click causes a value of 2 to appear. It should be 1.

VS 16.4.3
Windows 1909 18363.53
Genymotion 3.0.3 with Google Pixel 3 emulator.

Thanks

Mark.

Attachment: 20200115_104557_b38da743.zip

Praveen Koildasan [Syncfusion]
Replied On January 17, 2020 12:42 PM UTC

Hi Mark,

Thanks for your update.

We have ensured the reported issue from our side in Samsung S8, Lenovo and Moto devices and confirm that we are unable to reproduce the same. Since it is reproducible at your end, currently we are building our settings with Genymotion 3.0.3 with Google Pixel 3 emulator and we will update you further details once we have ensured. Also please ensure the same with some other devices and let us know the details.

Regards,
Praveen K.


Mark
Replied On February 3, 2020 09:16 AM UTC

Hi,

Have you any new findings to share?

Thanks

Mark.

Mark
Replied On February 19, 2020 07:45 AM UTC

Hi,

Still waiting for a response. Please let me know if I can give you more info.

Thanks

Mark.

Sakthivel Palaniyappan [Syncfusion]
Replied On February 20, 2020 07:17 AM UTC

Hi Mark,

Sorry for the delay response.

We have fixed the reported issue of “Memory leak in Android and iOS” and included the fix in our latest weekly NuGet release(17.4.0.50). Could you please upgrade the Syncfusion NuGet to latest version and please let us know if the reported  issue resolved with the  latest NuGet?

Regards,
Sakthivel P.
 


Mark
Replied On February 20, 2020 07:21 AM UTC

Thank you for this.

Has this been tested with my sample application to confirm that it is fixed?

Sakthivel Palaniyappan [Syncfusion]
Replied On February 21, 2020 03:54 AM UTC

Hi Mark,

Yes, we have checked your sample application with latest version 17.4.0.50 and its working fine.

Regards,
Sakthivel P.
 


Mark
Replied On February 21, 2020 08:32 AM UTC

I can confirm that this is fixed. I upgraded Nugets in my sample project and confirmed that UWP, Android and iOS are fixed.

Thank you very much.

Mark.

Divya Venkatesan [Syncfusion]
Replied On February 21, 2020 01:18 PM UTC

Hi Mark, 
 
Thanks for your update. 
 
We are glad to know that given solution works. 
 
Please let us know if you have any other queries. 
 
Regards,  
Divya Venkatesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon