docs: viper and garbage collection #15257
Replies: 3 comments 1 reply
-
In my understanding gc.collect kicks in automatically when you try to allocated ram for an object and that allocation fails due to lack of space - then gc.collect will be run and the allocation retried. viper functions can certainly allocate object / types that take ram so when that's done I'm sure gc.collect can be run. |
Beta Was this translation helpful? Give feedback.
-
By the same token if a Viper function doesn't allocate then GC won't kick in. I've converted this to a discussion as action from the maintainers is not required. |
Beta Was this translation helpful? Give feedback.
-
Thanks to you for the clarifications. As a principle, I don't allocate new objects inside viper functions (apart from viper integers). Unfortunately in a few cases these functions have to call normal Python functions... and who knows exactly their internals! |
Beta Was this translation helpful? Give feedback.
-
Documentation URL
https://docs.micropython.org/en/v1.7/pyboard/reference/speed_python.html
Description
Let say the garbage collector is enabled.
During the execution of functions decorated with viper, can the gc collector kick in or not?
Sorry I don't find this specification in the docs.
Code of Conduct
Yes, I agree
Beta Was this translation helpful? Give feedback.
All reactions