Fertogo / Pebble-workout-timer

Easily create Pebble-guided workouts from phone or computer
12 stars 6 forks source link

Long workouts crash - Memory Usage #46

Open Fertogo opened 9 years ago

Fertogo commented 9 years ago

Long workouts make the app crash during runtime. More specifically, a workout consisting of 20 5 second moves with names = 1,2....20 will crash after move 16.

Upon close inspection at the heap size during move 16 I notice this: [INFO] ocess_manager.c:297: Heap Usage for App <Workout Ti: Total Size <15168B> Used <15144B> Still allocated <1231 Looks like I am running out of memory, possibly because I am not clearing some variables/timers or destroying timer windows.

Fertogo commented 9 years ago

Looks like the problem is that every time I call createTimer I create a new Timer window, along with a bunch of layers. These are probably never destroyed. A fix would be to destroy all these layers when the next timer is created.

Fertogo commented 9 years ago

824ecae6696bbdb5606c3146ce19fc17d71f7467 Fixed the biggest of these issues, but the heap size still gets (slightly) larger the more moves happen. This indicates that there are still some resources that are not being reused, but it is not much of a concern for now.

Possible fixes: Loading window, instruction window, move name copying.