Problem with app properties suddenly using up lots of memory?

Has anyone come across a problem when running an app in the simulator (a watchface) that when they add one new property then the memory used by application settings in the simulator suddenly increases massively?



I don't even need to add the property as a setting for this to occur. And if I remove that property (or even a different property) then the memory usage suddenly drops back to normal again.



Maybe I am hitting a soft limit of some kind? I currently have 102 properties and the problem seems to occur when I go to 103 properties.



In the simulator memory usage view my normal <Application Settings> size is 2384(3949).

When I add the one extra property then the <Application Settings> size jumps to 9404(10981) by more than 7k!

And this has the unfortunate effect of making my watchface stop working when I try and change settings from the settings editor as there is no longer enough memory available in the app!
  • So 100+ properties seem to cause this. Is it only in the sim or on devices too?

    Are all 100+ properties used with app settings, or are some just used to store your own data? If so, I'd look at keeping the "local storage" in the Application.Store and not as a property, as with properties, all the data is likely being shipped back and forth with a phone when app settings is used.

    There will be a memory spike when you change settings for a running app, as for a period of time both the old and new data is needed, so another reason not to use properties as local storage.

    I know for me, I don't think I have a case where the number of properties is above the 20-30 range, while most apps are probably under 20.

    update: Ok, I did find one where I have around 40 properties
  • Thanks for the help and comments on this! Just sitting down to create a test app and investigate this further.

    Unfortunately all my properties are also connected to settings as I have lots of customizations which I'm really happy with! Just wanted to add one more awesome feature so this is a slight blocker.
  • Ok that was easy to replicate:

    I created a new project and made a Watchface for 3.0.x of type "Simple With Settings" for Fenix 5X Plus.
    Then I edited the properties.xml file to make there be 102 properties (see attached file).
    When I ran it then <Application Settings> memory size was 2384.
    I added one more property to make 103 and ran it again.
    The <Application Settings> memory size was now 9404.

    But things get slightly weirder.
    Running it again with 103 properties the <Application Settings> memory size was back down to 2384!
    Increasing properties one by one it stayed like this until 112 properties.
    Then at 113 properties the <Application Settings> memory size jumps to 9404 again.
    It now repeats every time switching between 112 & 113.

    So it seems like there is something odd going on.

    Anyway, I'll post this in the Bug Reports forums as well.
  • Former Member
    Former Member
    What you are seeing is the effect of a rehash that is occurring when the number of elements exceeds the load factor of the Dictionary. There does look to be something wrong here because it the hash is growing more than it should be.