Python vs MicroPython gc

Viewed 184

I am new to MicroPython and noticed that some scripts use gc lib.

I've never used gc in Python because I thought the garbage collector is a hidden reality.

So is it different in MicroPython? Do I need to switch it on explicitly on each script?

1 Answers

Actually, boards embedding MicroPython have a very limited amount of RAM as seen on this page.

MicroPython really initialises gc on startup (see doc).

Manually triggered, it seems to ensure that the board will have enough memory for incoming operations (socket reads, ...). Nevertheless, the latter page indicates that the memory allocator can possibly generate memory fragmentation, causing a lack of free space.

Related