Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Link to parent causes reference cycles #86

Closed
bmerry opened this issue Mar 4, 2017 · 1 comment
Closed

Link to parent causes reference cycles #86

bmerry opened this issue Mar 4, 2017 · 1 comment

Comments

@bmerry
Copy link

bmerry commented Mar 4, 2017

With addict 2.0.0, this code generates a reference cycle and may lead to memory leaks:

from addict import *
a = Dict()
a.x.y = 1

Here a contains a reference to a.x, and a.x.__parent__ points back to a, thus creating a cycle.

__setitem__ should probably clear __parent and __key after they've served their purpose.

@mewwts
Copy link
Owner

mewwts commented Mar 5, 2017

Thanks @bmerry. I've release 2.0.1 with the most of the fixes you've pointed out. I want to encourage you do a review of #84, and submit a PR in the future. You've already helped make addict a lot better.

@mewwts mewwts closed this as completed Mar 5, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants