apps: Replace del self.x with self.x = None in all apps
Testing has demonstrated that del self.x does not make the memory used to store x available for garbage collection. There is clearly an additional reference from another place. In fact *after* del self.x then the memory can be made available for GC by assignment (e.g. self.x = None). However I haven't found how to release this reference and there is nothing in self.__dict__ that can help. For now we'll use a twp-step process where we set the variable to None before deleting it. This has a big impact on memory usage. For Software it is almost 1k (a.k.a. about 10% impact on free RAM). Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
bbadbd34c7
commit
2858826921
3 changed files with 12 additions and 1 deletions
|
@ -124,10 +124,15 @@ class AlarmApp:
|
|||
|
||||
self.page = _HOME_PAGE
|
||||
|
||||
self.del_alarm_btn = None
|
||||
del self.del_alarm_btn
|
||||
self.hours_wid = None
|
||||
del self.hours_wid
|
||||
self.min_wid = None
|
||||
del self.min_wid
|
||||
self.alarm_checks = None
|
||||
del self.alarm_checks
|
||||
self.day_btns = None
|
||||
del self.day_btns
|
||||
|
||||
self._set_pending_alarms()
|
||||
|
@ -373,4 +378,4 @@ class AlarmApp:
|
|||
elif days == 0:
|
||||
return "once"
|
||||
else:
|
||||
return "cust"
|
||||
return "cust"
|
||||
|
|
|
@ -37,8 +37,11 @@ class FacesApp():
|
|||
wasp.system.request_event(wasp.EventMask.SWIPE_UPDOWN)
|
||||
|
||||
def background(self):
|
||||
self.choices = None
|
||||
del self.choices
|
||||
self.choice = None
|
||||
del self.choice
|
||||
self.si = None
|
||||
del self.si
|
||||
|
||||
# When the watch face redraws then the change to the scrolling indicator
|
||||
|
|
|
@ -67,8 +67,11 @@ class SoftwareApp():
|
|||
wasp.EventMask.SWIPE_UPDOWN)
|
||||
|
||||
def background(self):
|
||||
self.si = None
|
||||
del self.si
|
||||
self.page = None
|
||||
del self.page
|
||||
self.db = None
|
||||
del self.db
|
||||
|
||||
def get_page(self):
|
||||
|
|
Loading…
Reference in a new issue