summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2021-07-28 21:01:04 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2021-07-28 21:01:04 (GMT)
commit28588269215aebf36c89cbb4c1b8014929340ac4 (patch)
treebbfcece49226a6120e07f3b8bc1f48954c0cec88
parentbbadbd34c74ef2ef4da0ccda7d5250987374bcbb (diff)
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>
-rw-r--r--wasp/apps/alarm.py7
-rw-r--r--wasp/apps/faces.py3
-rw-r--r--wasp/apps/software.py3
3 files changed, 12 insertions, 1 deletions
diff --git a/wasp/apps/alarm.py b/wasp/apps/alarm.py
index 4d87b0c..1792bc6 100644
--- a/wasp/apps/alarm.py
+++ b/wasp/apps/alarm.py
@@ -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" \ No newline at end of file
+ return "cust"
diff --git a/wasp/apps/faces.py b/wasp/apps/faces.py
index 7e3ed3e..9ce8083 100644
--- a/wasp/apps/faces.py
+++ b/wasp/apps/faces.py
@@ -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
diff --git a/wasp/apps/software.py b/wasp/apps/software.py
index 9e764bc..91bde38 100644
--- a/wasp/apps/software.py
+++ b/wasp/apps/software.py
@@ -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):