Print statement management in micropython

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
lnsri22
Posts: 75
Joined: Fri Aug 17, 2018 12:16 pm
Location: India

Print statement management in micropython

Post by lnsri22 » Tue Jan 22, 2019 7:35 am

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!!
lnsri22 :)

Maksym Galemin
Posts: 11
Joined: Mon May 28, 2018 11:48 pm

Re: Print statement management in micropython

Post by Maksym Galemin » Tue Jan 22, 2019 8:37 am

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...

lnsri22
Posts: 75
Joined: Fri Aug 17, 2018 12:16 pm
Location: India

Re: Print statement management in micropython

Post by lnsri22 » Tue Jan 22, 2019 9:27 am

Thanks again!!

Went through the code snippets in the link. :D
lnsri22 :)

Post Reply