Skip to content

Commit 75feece

Browse files
committed
py/gc: Make GC block size be configurable.
1 parent 0077958 commit 75feece

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

py/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
// make this 1 to dump the heap each time it changes
4747
#define EXTENSIVE_HEAP_PROFILING (0)
4848

49-
#define WORDS_PER_BLOCK (4)
50-
#define BYTES_PER_BLOCK (WORDS_PER_BLOCK * BYTES_PER_WORD)
49+
#define WORDS_PER_BLOCK ((MICROPY_BYTES_PER_GC_BLOCK) / BYTES_PER_WORD)
50+
#define BYTES_PER_BLOCK (MICROPY_BYTES_PER_GC_BLOCK)
5151

5252
// ATB = allocation table byte
5353
// 0b00 = FREE -- free block

py/mpconfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@
9696
/*****************************************************************************/
9797
/* Memory allocation policy */
9898

99+
// Number of bytes in memory allocation/GC block. Any size allocated will be
100+
// rounded up to be multiples of this.
101+
#define MICROPY_BYTES_PER_GC_BLOCK (4 * BYTES_PER_WORD)
102+
99103
// Number of words allocated (in BSS) to the GC stack (minimum is 1)
100104
#ifndef MICROPY_ALLOC_GC_STACK_SIZE
101105
#define MICROPY_ALLOC_GC_STACK_SIZE (64)

0 commit comments

Comments
 (0)