Skip to content

what is the actual intention behind deinit() and its implementation ? #9360

Discussion options

You must be logged in to vote

init() does not create an object like tim1, it configures it. And then deinit() is its complementary. The object it created by the constructor e.g. tim1 = machine.Timer(.....).

The object that you created, like tim1 in your example, continues to exist because it is in the actual namespace of your code. The class method deinit() cannot remove it from that namespace holding it. It will go away as soon as this name gets out of focus. Then gc can clear that object.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Flipje1955
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants