Implicit Button Style on Android causes memory leak

JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

As soon as we have an implicit style in App.xaml:

       <Style TargetType="Button">
            <Setter Property="FontSize" Value="{DynamicResource BaseFontSize}" />
            <Setter Property="HeightRequest" Value="{DynamicResource BaseButtonHeight}" />
            <Setter Property="BackgroundColor">
                <Setter.Value>
                    <OnPlatform x:TypeArguments="Color" Android="#d6d6d6" />
                </Setter.Value>
            </Setter>
        </Style>

We get leak in our application. Just navigating to a page with a Button and back again (by popping) leaves memory behind.

Removing the Style removes the leak.

Any ideas on the cause and a resolution?

Version information:
Xamarin.Forms 2.3.4.270
UXDivers.Artina.Shared 2.0.52
UXDivers.Artina.Shared.Base 2.0.52
UXDivers.Effects 0.6.0

App running on Android 6.0.1

=== Visual Studio Community 2017 for Mac ===

Version 7.1.3 (build 1)
Installation UUID: 650b4c91-c7f5-4ee5-ad70-6f178f314906
Runtime:
Mono 5.2.0.224 (d15-3/14f2c81) (64-bit)
GTK+ 2.24.23 (Raleigh theme)

Package version: 502000224

=== NuGet ===

Version: 4.3.0.2418

=== .NET Core ===

Runtime: Not installed
SDK: Not installed
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 7.4.3.1 (Visual Studio Community)
Android SDK: /Users/jameslavery/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.3 (API level 18)
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.5
SDK Build Tools Version: 25.0.3

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Apple Developer Tools ===

Xcode 8.0 (11246)
Build 8A218a

=== Xamarin.iOS ===

Version: 10.12.3.3 (Visual Studio Community)
Hash: 8a391069
Branch: d15-3
Build date: 2017-08-28 16:51:11-0400

=== Xamarin.Mac ===

Version: 3.6.3.3 (Visual Studio Community)

=== Xamarin Inspector ===

Version: 1.3.0
Hash: 8c298a5
Branch: 1.3-release
Build date: Thu, 14 Sep 2017 21:21:26 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 701030001
Git revision: ba94259b26824844f4d2c76c794738eb75b85726
Build date: 2017-08-25 16:28:43-04
Xamarin addins: ee499cfb63ae406b1e394bf6a159ad2953f7fab6
Build lane: monodevelop-lion-d15-3

=== Operating System ===

Mac OS X 10.11.6
Darwin 15.6.0 Darwin Kernel Version 15.6.0
Thu Jun 23 18:25:34 PDT 2016
root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

LiveXAML 1.0
Redth's Addins 1.0.9

Answers

  • JohnHardmanJohnHardman GBUniversity mod
    edited September 2017

    @JamesLavery - Can you log a bug for this if you haven't already.

    I'm in the midst of re-factoring to use styles comprehensively. I haven't profiled since starting the re-factoring, but I have noticed (but not yet investigated) a slowdown on Android since starting the re-factor. I noticed it with 2.3.4.267, but have updated to 2.3.4.270 and not seen any improvement.

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    Stripping down to a basic project removes the leak. So it must be something we're using/doing. We use Grial for styling, so that's the first suspect. I'll post results here.

  • NMackayNMackay GBInsider, University mod

    @JamesLavery

    I haven't seen anything in the 2.4.0-pre release notes regarding this issue, if you could let us know if it's a memory leak it would be very helpful, we use this implicit style approach for every button in our app :neutral:

Sign In or Register to comment.