Debugging memory consumption

Former Member
Former Member
Hello,

I have noticed a problem with the memory consumption in a data field. The simulator says, that 15/16kb are used and suddenly a out-of-memory exception is thrown. Sometimes the log shows a line number where the failure occurred, but nothing on the mentioned line is requesting additional memory.
Is there anyway to debug the occupied memory? The benefit of memory dialog is limited, because it only shows the memory content for a certain point in time.

Kind regards

Moritz
  • One thing to note in the simulator, is the line at the bottom (pre 2.1.0 SDK) shows the amount of memory used when the app/DF is idle (not running compute() or onUpdate(), etc ). (in 2.1.0, a "peak" usage is also displayed which is nice!).

    If your idle DF is using 15k, almost anything or multiple things could push it to 16k, and your best bet may be to just try to get the idle memory usage down.
  • I haven't really found a good way to debug this type of problem. The trick is to stay well below the limit at all times.

    Travis
  • Any tips on reducing memory usage? And please don't say "don't use classes" :p
  • One thing I've heard is to avoid using layouts, and use dc calls instead. (I don't use layouts to begin with, so I've never tested this myself)
  • Former Member
    Former Member over 8 years ago
    Thanks for your tipps.
    Another thing to avoid are strings files for different languages. These will also be held in memory.

    Another odd thing I have noticed with the simulator: Sometimes when I have restarted Eclipse the shown allocated memory in simulator is slightly lower than before (restarting the simulator doesn't help).
  • And please don't say "don't use classes"

    Everything is class in CIQ.

    Array is larger than ordinal variables.
    Multidimensional arrays larger than two, three... linear arrays.
    Dictionaries waste memory dramatically.
    Iterators ... hmm.. one time it runs ok, or crashes at start. No matter restart IDE or not.
    For 200 bytes overhead is tremendous - 10KB.

    Another thing to avoid are strings files for different languages. These will also be held in memory.

    I don't think so. loadResource solves this issue.
  • Former Member
    Former Member over 8 years ago
    I don't think so. loadResource solves this issue.


    Only creating the xml files is heavily increasing the allocated memory. So far we can trust in the memory consumption shown by the simulator.
  • I have now tested and can report that reducing the depth of a class hierarchy can save a lot of memory. Use "extends" sparingly.