When you say "I am trying to use MICROPY_ENABLE_GC" I assume this means you have actually enabled the GC.
To explain your earlier issue, what you're doing is essentially the same as
It can't free the old data for "a" until after it has assigned the new value for a, so the peak memory is always 2000 items.
Code: Select all
a = *1000 a = *1000
The solution is to either "soft reset" MicroPython in between scripts, or to change your code such that nothing is left in global scope (e.g. with a function as described). Or manually take things out of scope using "del a".