diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-05 22:48:02 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-05 22:48:02 +0300 |
commit | 755a55f5070c442a7e2bacf976a73359d1da68a2 (patch) | |
tree | 8aa5dc52c5753a2984c879ec2f8086d06052c0fc /py/gc.c | |
parent | d4c2bddd0c768da12d0cefd3c405b10e75fa5aa9 (diff) | |
download | micropython-755a55f5070c442a7e2bacf976a73359d1da68a2.tar.gz micropython-755a55f5070c442a7e2bacf976a73359d1da68a2.zip |
modgc: Implement return value for gc.collect(), enable on Unix.
Diffstat (limited to 'py/gc.c')
-rw-r--r-- | py/gc.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -231,7 +231,14 @@ STATIC void gc_deal_with_stack_overflow(void) { } } +#if MICROPY_PY_GC_COLLECT_RETVAL +uint gc_collected; +#endif + STATIC void gc_sweep(void) { + #if MICROPY_PY_GC_COLLECT_RETVAL + gc_collected = 0; + #endif // free unmarked heads and their tails int free_tail = 0; for (machine_uint_t block = 0; block < gc_alloc_table_byte_len * BLOCKS_PER_ATB; block++) { @@ -254,6 +261,9 @@ STATIC void gc_sweep(void) { } #endif free_tail = 1; + #if MICROPY_PY_GC_COLLECT_RETVAL + gc_collected++; + #endif // fall through to free the head case AT_TAIL: |