You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am using a fair amount of trees (on some evolutionary computing task) and I find misself with some memory leak, I've traced the problem down to treelib's deepcopy. Is it possible that, when creating a Tree from another one (using the tree parameter and deep=True), it creates some link between the trees?
I perform loops on lists of trees, in each loop, I generate a new list and delete the previous one:
del list
gc.collect()
The new list is generated partially from trees from the previous list using Tree(tree=previous_tree, deep=True). The thing is that deleting the list does not free memory and my program's memory keeps increasing after each iteration. tracemalloc's stats suggest the problem is in treelib's deepcopy.
child = TreeOperations.deep_copy(parent)
File "/home/raquel/Documents/STUDIES/uned/uned/CE/A3/proj/trees.py", line 413
tree = Tree(tree=a.tree, deep=True)
File "/home/raquel/Documents/STUDIES/uned/uned/CE/venv/lib/python3.7/site-packages/treelib/tree.py", line 106
new_node = deepcopy(node) if deep else node
File "/usr/lib/python3.7/copy.py", line 180
y = _reconstruct(x, memo, *rv)
File "/usr/lib/python3.7/copy.py", line 281
state = deepcopy(state, memo)
File "/usr/lib/python3.7/copy.py", line 150
y = copier(x, memo)
File "/usr/lib/python3.7/copy.py", line 241
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.7/copy.py", line 180
y = _reconstruct(x, memo, *rv)
File "/usr/lib/python3.7/copy.py", line 307
value = deepcopy(value, memo)
File "/usr/lib/python3.7/copy.py", line 150
y = copier(x, memo)
File "/usr/lib/python3.7/copy.py", line 216
append(deepcopy(a, memo))
File "/usr/lib/python3.7/copy.py", line 169
rv = reductor(4)
File "/usr/lib/python3.7/uuid.py", line 208
state = self.__dict__.copy()
The text was updated successfully, but these errors were encountered:
Hi, I am using a fair amount of trees (on some evolutionary computing task) and I find misself with some memory leak, I've traced the problem down to treelib's
deepcopy
. Is it possible that, when creating a Tree from another one (using thetree
parameter anddeep=True
), it creates some link between the trees?I perform loops on lists of trees, in each loop, I generate a new list and delete the previous one:
The new list is generated partially from trees from the previous list using
Tree(tree=previous_tree, deep=True)
. The thing is that deleting the list does not free memory and my program's memory keeps increasing after each iteration.tracemalloc
's stats suggest the problem is in treelib's deepcopy.The text was updated successfully, but these errors were encountered: