Datastore lifetime/cleanup best practice

When you create a datastore and add it to a channel (using ast_datastore_alloc(…) and ast_datastore_add(…)) does it get automatically get destroyed when the channel closes, or do you have to clean it up yourself?

The destructor for it should be called when the channel goes away, provided you don’t leak a reference yourself.