I am refactoring an app I wrote for a vivoactive HR (128kb limit) for devices with less memory (right now vivoactive with 64kb limit).
I am trying to optimize everything as best I can but I ran into an interesting issue I am not sure how to deal with it.
I have a method to pause a workout and show a menu which allows you Save / Discard / Resume.
I noticed that when I toggle to pause the workout and resume it, about 10kb of memory get added to the used pool, and every time you do this, it adds.
For example: 50kb memory used -> Pause / Resume 60kb memory used -> Pause / Resume 70kb used.
It looks as if the "setLayout" method is what is doing this.
Am I doing something wrong where I should be doing something in the onHide function? I have tried doing setLayout(null) in onHide to no avail.
Aside from the usual tips of using less bitmaps, narrowing variable scope, etc. What can do to further lower the memory usage?
As an aside - the app is fairly heavy on bitmaps / fonts and I realize that when I try to refactor for a device with a very low 16kb limit I will have to remove them - however right now I am trying to refactor for a 64kb device which seems workable with my current set of resources.
Here is my source code if you'd like to have a look:
https://github.com/werkkrew/ciq-orange-theory