summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-04-01 11:59:15 -0500
committerJeff Epler <jepler@gmail.com>2020-04-14 18:24:58 -0500
commit3a94412cd35c39bf30f29cb2b79be3870709c809 (patch)
tree8a2653aa8a7ca665f0f70b74172cc964d33504b2 /supervisor
parent1d8a073c05c36133e02d839ed187b9d7abf24d79 (diff)
protomatter: more memory allocation fixes
- bump supervisor alloc count by 4 (we actually use 5) - move reconstruct to after gc heap is reset - destroy protomatter object entirely if not used by a FramebufferDisplay - ensure previous supervisor allocations are released - zero out pointers so GC can collect them
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/display.c9
-rwxr-xr-xsupervisor/shared/memory.c2
2 files changed, 10 insertions, 1 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c
index 855432d64..050ba6e19 100644
--- a/supervisor/shared/display.c
+++ b/supervisor/shared/display.c
@@ -29,6 +29,7 @@
#include <string.h>
#include "py/mpstate.h"
+#include "shared-module/displayio/__init__.h"
#include "shared-bindings/displayio/Group.h"
#include "shared-bindings/displayio/Palette.h"
#include "shared-bindings/displayio/TileGrid.h"
@@ -112,6 +113,14 @@ void supervisor_display_move_memory(void) {
grid->inline_tiles = false;
}
MP_STATE_VM(terminal_tilegrid_tiles) = NULL;
+ #if CIRCUITPY_PROTOMATTER
+ for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+ if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) {
+ protomatter_protomatter_obj_t * pm = &displays[i].protomatter;
+ common_hal_protomatter_protomatter_reconstruct(pm, NULL);
+ }
+ }
+ #endif
#endif
}
diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c
index 51037bd6d..d52334eb4 100755
--- a/supervisor/shared/memory.c
+++ b/supervisor/shared/memory.c
@@ -31,7 +31,7 @@
#include "supervisor/shared/display.h"
-#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT 8
+#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT (12)
static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT];
// We use uint32_t* to ensure word (4 byte) alignment.