diff options
author | Dave Hylands <dhylands@gmail.com> | 2015-11-06 14:32:47 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-11-07 14:26:11 +0000 |
commit | 7f3c0d1ea8fa21df3b2078c7189f2b26fe36da59 (patch) | |
tree | 885907a70dafd8a91fa8240d338d76d333ed46ef /py/gc.h | |
parent | 41b688e25f537479afc0b0e806cd0cb02ea47bb0 (diff) | |
download | micropython-7f3c0d1ea8fa21df3b2078c7189f2b26fe36da59.tar.gz micropython-7f3c0d1ea8fa21df3b2078c7189f2b26fe36da59.zip |
py: Clear finalizer flag when calling gc_free.
Currently, the only place that clears the bit is in gc_collect.
So if a block with a finalizer is allocated, and subsequently
freed, and then the block is reallocated with no finalizer then
the bit remains set.
This could also be fixed by having gc_alloc clear the bit, but
I'm pretty sure that free is called way less than alloc, so doing
it in free is more efficient.
Diffstat (limited to 'py/gc.h')
-rw-r--r-- | py/gc.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -46,7 +46,7 @@ void gc_collect_root(void **ptrs, mp_uint_t len); void gc_collect_end(void); void *gc_alloc(mp_uint_t n_bytes, bool has_finaliser); -void gc_free(void *ptr); +void gc_free(void *ptr); // does not call finaliser mp_uint_t gc_nbytes(const void *ptr); void *gc_realloc(void *ptr, mp_uint_t n_bytes, bool allow_move); |