aboutsummaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky2015-12-03 01:40:52 +0200
committerPaul Sokolovsky2015-12-03 01:40:52 +0200
commit75feece208fbf48c27099a4279cefcef42de4751 (patch)
treefe48127841bde4e7b5df7f58fbba7e6be5d9f778 /py
parent0077958ad0d278c87620ee8ead9a9aea80f1663d (diff)
py/gc: Make GC block size be configurable.
Diffstat (limited to 'py')
-rw-r--r--py/gc.c4
-rw-r--r--py/mpconfig.h4
2 files changed, 6 insertions, 2 deletions
diff --git a/py/gc.c b/py/gc.c
index 6de8a7a02..cca28b41f 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -46,8 +46,8 @@
// make this 1 to dump the heap each time it changes
#define EXTENSIVE_HEAP_PROFILING (0)
-#define WORDS_PER_BLOCK (4)
-#define BYTES_PER_BLOCK (WORDS_PER_BLOCK * BYTES_PER_WORD)
+#define WORDS_PER_BLOCK ((MICROPY_BYTES_PER_GC_BLOCK) / BYTES_PER_WORD)
+#define BYTES_PER_BLOCK (MICROPY_BYTES_PER_GC_BLOCK)
// ATB = allocation table byte
// 0b00 = FREE -- free block
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 1f01b3de5..922f865e2 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -96,6 +96,10 @@
/*****************************************************************************/
/* Memory allocation policy */
+// Number of bytes in memory allocation/GC block. Any size allocated will be
+// rounded up to be multiples of this.
+#define MICROPY_BYTES_PER_GC_BLOCK (4 * BYTES_PER_WORD)
+
// Number of words allocated (in BSS) to the GC stack (minimum is 1)
#ifndef MICROPY_ALLOC_GC_STACK_SIZE
#define MICROPY_ALLOC_GC_STACK_SIZE (64)