recursively delete python dictionary
I have a large body of code, that uses some custom classes and a lot of
dictionaries. Many of the classes get dictionaries added as attributes. I
am finding that it uses too much memory, especially if I am looping --
even if I manually delete some of the classes and dicts.
What I fear is happening is that the dictionaries are getting deleted, but
the objects which they contain persist. I need to refactor the code for
better memory management, but as a quick solution I was hoping I could
recursively and aggresively delete the dictionaries. How would this be
achieved?
No comments:
Post a Comment