summaryrefslogtreecommitdiff
path: root/wasp/wasp.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-12 21:35:45 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-13 16:07:24 (GMT)
commit784c9bb36d29457ddb3a5ef5af55918e1f4cd93c (patch)
treee44d31b9f8e2402b999555d0eae8ac6ad7b4fa3d /wasp/wasp.py
parent338925b4a8e8d7ce54d0ac7e6c9c7b3bd6110737 (diff)
apps: testapp: Automatically report free memory
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/wasp.py')
-rw-r--r--wasp/wasp.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/wasp/wasp.py b/wasp/wasp.py
index 7f4d0d4..7cf2883 100644
--- a/wasp/wasp.py
+++ b/wasp/wasp.py
@@ -441,12 +441,17 @@ class Manager():
normal execution context meaning any exceptions and other problems
can be observed interactively via the console.
"""
+ global free
+
if self._scheduling:
print('Watch already running in the background')
return
if not self.app:
self.switch(self.quick_ring[0])
+ if watch.free:
+ gc.collect()
+ free = gc.mem_free()
# Reminder: wasptool uses this string to confirm the device has
# been set running again.
@@ -494,8 +499,13 @@ class Manager():
def schedule(self, enable=True):
"""Run the system manager synchronously."""
+ global free
+
if not self.app:
self.switch(self.quick_ring[0])
+ if watch.free:
+ gc.collect()
+ free = gc.mem_free()
if enable:
watch.schedule = self._schedule