Complete

This is by design.

The settings are being serialized to send to the simulator or phone.

opening settings editor consumes app memory

sdk 4.0.7
eclipse CIQ plug in: 4.1.0.beta1
eclipse ver: 2021-09 (4.21.0) Build id: 20210910-1417
windows 10
watch face
minSdkVersion 2.4.0

CASE 1

wf starts, peak memory 88.0

[ecilpse][app settings editor] - open only window and choose project (no push any buttons), peak memory 90.0

CASE 2

wf starts, peak memory 88.0

[simulator][property data]  - open only window (no push any buttons), peak memory 90.0

In both cases there is no calls for app.onSettingsChanged, settings data exist in memory so there shouldn't additional memory consumption.

Now, when you have e.g. 90.5 kB used from 92 there is an error "unable to serialise data" or "out of memory exception" if i choose OK in setting editor.

Parents
  • "But I'm almost sure that more number of  strings = more memory need (more members)."

    Yes that's what I said. But I also said that the *contents* of the strings don't matter. Rez.strings has resource IDs/symbols, not actual strings.

    You can test this easily by creating two strings in your resources, each 10 chars long, and calling loadResource() once (on one of the strings).

    Now change the *other* string to be much longer (like 255 chars) and run your code again. You will see that the peak memory will remain unchanged (as well as the memory taken up by Rez/Strings.

    Just now I tried a similar test with one of my apps, which calls loadResource() at least once:

    - Change one string (not loaded by the app) to be a lot longer: memory usage does not increase by a single byte

    - Add one string: total memory usage increases (global memory usage increases by exactly 12 bytes). 12 bytes per string is *huge*, especially for devices with only 16 KB or 32 KB of RAM for a data field.

    Why do I care? It goes back to strings that are only used for application settings. If my app calls loadResource() at least once, then every string I add (even if it's just for app settings) wastes memory. But at least it doesn't matter how long the strings are.

    It also means that I can store certain kinds of data as a very long string resource to try and save memory (although this kind of trick is only useful in very limited circumstances, like for old devices where JSON resources are unavailable and when the data that's being stored is only needed at init time, as opposed to all the time.)

Comment
  • "But I'm almost sure that more number of  strings = more memory need (more members)."

    Yes that's what I said. But I also said that the *contents* of the strings don't matter. Rez.strings has resource IDs/symbols, not actual strings.

    You can test this easily by creating two strings in your resources, each 10 chars long, and calling loadResource() once (on one of the strings).

    Now change the *other* string to be much longer (like 255 chars) and run your code again. You will see that the peak memory will remain unchanged (as well as the memory taken up by Rez/Strings.

    Just now I tried a similar test with one of my apps, which calls loadResource() at least once:

    - Change one string (not loaded by the app) to be a lot longer: memory usage does not increase by a single byte

    - Add one string: total memory usage increases (global memory usage increases by exactly 12 bytes). 12 bytes per string is *huge*, especially for devices with only 16 KB or 32 KB of RAM for a data field.

    Why do I care? It goes back to strings that are only used for application settings. If my app calls loadResource() at least once, then every string I add (even if it's just for app settings) wastes memory. But at least it doesn't matter how long the strings are.

    It also means that I can store certain kinds of data as a very long string resource to try and save memory (although this kind of trick is only useful in very limited circumstances, like for old devices where JSON resources are unavailable and when the data that's being stored is only needed at init time, as opposed to all the time.)

Children
No Data