too much RAM usage

2 posts, 0 answers
  1. Georgi Yakov
    Georgi Yakov avatar
    1 posts
    Member since:
    Dec 2018

    Posted 05 Dec 2018 Link to this post

    Hello, I made an App for Xamarin.Android using RadRadialGauge. I have a Thread that updates the indicator every 500ms based on a received value. The problem is that the longer the App runs the slower it becomes. I checked the RAM usage and it increases really fast, it reaches 200MB in a matter of a few minutes and as result the App becomes very laggy and it doesn't show a good performance. When I try to comment the indicator it works fine. I would like to ask if there is a way to reduce the RAM usage. Here is my Code: 

    MainPage.xaml

    <telerikGauges:RadRadialGauge StartAngle="180" SweepAngle="360">
                    <telerikGauges:RadRadialGauge.Axis>
                        <telerikGauges:GaugeLinearAxis Maximum="100"
                                                           Minimum="0"
                                                           ShowLabels="False"
                                                           StrokeThickness="0" />
                    </telerikGauges:RadRadialGauge.Axis>
                    <telerikGauges:RadRadialGauge.Ranges>
                        <telerikGauges:GaugeRangesDefinition Offset="0">
                            <telerikGauges:GaugeRange Color="#DDDDDD"
                                                          From="0"
                                                          To="100" />
                        </telerikGauges:GaugeRangesDefinition>
                    </telerikGauges:RadRadialGauge.Ranges>
                    <telerikGauges:RadRadialGauge.Indicators>
                        <telerikGauges:GaugeBarIndicator x:Name="Needle1" EndCap="Oval"
                                            Fill="#a13127"
                                            StartCap="Oval"
                                            Offset="0"
                                            Value="0.45" />
                    </telerikGauges:RadRadialGauge.Indicators>
                </telerikGauges:RadRadialGauge>
                <Label x:Name="GaugeLabel" FontSize="44"
                               HorizontalTextAlignment="Center"
                               Text="120"
                               TextColor="#a13127"
                               VerticalTextAlignment="Center" />

     

    MainPage.xaml.cs

    Thread t = new Thread(new ThreadStart(() =>
                    {
                        while (true)
                        {
                           
                            Device.BeginInvokeOnMainThread(() =>
                            {
                                Needle1.Value = Val; // if I comment this line here RAM usage is normal
                                GaugeLabel.Text = Val.ToString("0.00");
                               
                            });
                            Thread.Sleep(500);
                        }

                    }));
                    t.Start();

  2. Didi
    Admin
    Didi avatar
    197 posts

    Posted 06 Dec 2018 Link to this post

    Hello Georgi,

    Thank you for the provided code.

    I have tested the described scenario with the RadGauge control and I could not reproduce the issue with the RAM usage. I have tried different scenarios while tracking Android RAM usage - please check the attached gauge-ram-android.png file.

    Please take a look at the attached project and let me know if I am missing something.

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top