Page 1 of 1

Print statement management in micropython

Posted: Tue Jan 22, 2019 7:35 am
by lnsri22
Hello Everyone!!

Please excuse me , if this question seems a bit foolish!!

I am just trying to understand the memory management in MicroPython. As a part of it, I am putting this question here.

What happens when I put bunch of print statements in my coroutines (I have nearly 10 coros running at different time frames). Would this impact the memory management ?

Does heap get fragmented, because of this?


Thanks in advance!!

Re: Print statement management in micropython

Posted: Tue Jan 22, 2019 8:37 am
by Maksym Galemin
Regarding the memory management including some useful debugging techniques:

https://docs.micropython.org/en/latest/ ... l#the-heap

I don't think print() itself explicitly allocates any memory according to the mp_builtin_print() function (py/modbuiltins.c). However, your arguments to print() potentially could involve some memory allocations...

Re: Print statement management in micropython

Posted: Tue Jan 22, 2019 9:27 am
by lnsri22
Thanks again!!

Went through the code snippets in the link. :D