MichaelRumpler / GestureSample

Sample App for MR.Gestures
MIT License
58 stars 17 forks source link

Mr.Gestures.Scrollview not releasing memory in Android #4

Closed julien-vandooren closed 8 years ago

julien-vandooren commented 8 years ago

Hi Michael,

I experiment a quite annoying problem on Android using the Mr.Gestures.Scrollview. I have quite a large ScrollView with a lot of image views in it (quite memory consuming) but when I disposed the page, it seems that the memory allocation of this ScrollView is never released. Thus after a few tries => OutOfMemory crash.

When I replace the ScrollView by the Xamarin.Forms.ScrollView, the memory is released as expected. I did not test on iOS.

Any insights on this ?

Thanks, Julien

MichaelRumpler commented 8 years ago

Hi,

thanks for reporting this. Do you have a test page which shows this behavior?

When I originally wrote MR.Gestures, I checked if all elements were properly released. I didn’t check with the latest XF versions though.

Regards, Michael

julien-vandooren commented 8 years ago

It's quite hard to extract the elements from my project but basically it is just a ScrollView with a StackLayout that contains approx. 10 middle-size images. Regarding Xamarin Forms, I'm currently using V2.3.0.107

MichaelRumpler commented 8 years ago

I checked MR.Gestures with the current XF version. All resources are still released.

To reproduce the memory leak, I added a test page to the GestureSample. You can find it in Tests/ScrollViewWithImages. I also changed the images to 1920x1024 to run out of memory earlier.

The app crashes indeed when you open/close it about 20-30 times. But then I changed the MR.Gestures.ScrollView to a Xamarin.Forms.ScrollView and it still crashed. So I don't think that this is a bug of MR.Gestures.

Android does have problems with big images. So I had to shrink the images of my cat in the first Android version of the GestureSample to 1024x410. XF got better in the meantime. Now the 1920x768 images work ok for a time, but sooner or later they still crash.

These web pages might help you:

I'll close this issue. Should you be able to track it down and be sure, that it only happens with MR.Gestures, then please adopt the ScrollViewWithImages page in the GestureSample and reopen this issue.