Replies: 2 comments 6 replies
-
MicroPython doesn't use reference counting. Instead, if you need to keep an object alive, it needs to be pointed to via an object reachable through a "root pointer". So you can make a pointer from some other MicroPython object to the one that gets passed to C. Or you can create your own root pointers if needed with the |
Beta Was this translation helpful? Give feedback.
-
For example, in the Python environment, there is a piece of code like this
At this point, the object generated by So we should add a reference to the font function, which is an extension of C, how can we add a reference to this object in C? |
Beta Was this translation helpful? Give feedback.
-
When using C to extend MicroPython, some objects are created in the Python environment and directly passed to C through functions for processing. However, in the Python environment, variables are not assigned, which may result in garbage collection during GC. When using C to extend Python, macros such as "Py-INCREF" and "Py-DECREF" can be called to define the number of references to the operation object. In MicroPython development, I haven't found any similar macro definitions or functions, how should I solve them?
Beta Was this translation helpful? Give feedback.
All reactions