summaryrefslogtreecommitdiff
path: root/py/mpstate.h
diff options
context:
space:
mode:
authorAyke van Laethem <aykevanlaethem@gmail.com>2018-02-23 18:59:31 +0100
committerDamien George <damien.p.george@gmail.com>2018-12-04 17:17:25 +1100
commit31cf528c754c5cf42410ff7c5471f0235493c0f2 (patch)
tree2b699575b692379820a7630e6a6b7ad2faefe65f /py/mpstate.h
parent62b4bebf6437df1a1a82747421c1ab94f46c15c2 (diff)
py: Add option to reduce GC stack integer size to save RAM.
A new option MICROPY_GC_STACK_ENTRY_TYPE is added to select a custom type instead of size_t for the gc_stack array items. This can be beneficial for small devices, especially those that are low on memory anyway. If a device has 1MB or less of heap (and 16-byte GC blocks) then this type can be uint16_t, saving 128 bytes of RAM.
Diffstat (limited to 'py/mpstate.h')
-rw-r--r--py/mpstate.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/mpstate.h b/py/mpstate.h
index 8c3b710cb..98371ca64 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -77,7 +77,7 @@ typedef struct _mp_state_mem_t {
byte *gc_pool_end;
int gc_stack_overflow;
- size_t gc_stack[MICROPY_ALLOC_GC_STACK_SIZE];
+ MICROPY_GC_STACK_ENTRY_TYPE gc_stack[MICROPY_ALLOC_GC_STACK_SIZE];
uint16_t gc_lock_depth;
// This variable controls auto garbage collection. If set to 0 then the