Skip to content

Removing Objects created from external library and attached to root-pointers #9684

Discussion options

You must be logged in to vote
  1. Search the MicroPython source code for __del__ for examples: wrap your datastore_channel_remove like STATIC MP_DEFINE_CONST_FUN_OBJ_1(datastore_channel_remove_obj, datastore_channel_remove); then add that datastore_channel_remove_obj to your locals dict with the name MP_QSTR___del__. It's similar to CPython.

  2. You don't do anything, and because your object isn't in the root pointers list anymore, gc will take care of it. Not that that is not a guarantee when or even if that will happen, but that is just how gc works.

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@birdistheword96
Comment options

Comment options

You must be logged in to vote
8 replies
@birdistheword96
Comment options

@stinos
Comment options

@jimmo
Comment options

@birdistheword96
Comment options

@jimmo
Comment options

Answer selected by birdistheword96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants