Nov-02-2018, 03:51 PM
Short answer: you shouldn't worry about it unless you're actively having issues. If you are actively having issues, I strongly recommend you refactor your code to use object oriented programming where a cache can be managed explicitly rather than what I'm about to say to answer your question.
In your code you have
In your code you have
import slave
. Once you're done with it, you can do del slave
and then Python, when it feels like it, can free the memory associated. You can look into the garbage collection module if that's still not enough.