nucleic / enaml

Declarative User Interfaces for Python
http://enaml.readthedocs.io/en/latest/
Other
1.52k stars 130 forks source link

Shouldn't Object parent and ProxyToolkitObject declaration be using atomref? #533

Closed frmdstryr closed 9 months ago

frmdstryr commented 9 months ago

I am trying to figure out a memory leak with enaml-web. When I do a bench test of thousands of requests I see the memory usage slowly creeping up.

After debugging I realized that the application must explicitly call destroy on every root enaml node or all children and proxy elements are leaked. Given it is python this seems like it should be unnecessary.

I was able to make it automatically clean up by adding a __del__ method to the Declaration and making the _parent and proxy's backref to the declaration use atomref (see https://github.com/frmdstryr/enaml/tree/atomref-decl-parent). Would it make sense to do this by default?

Edit: If this would happen to be done it would be nice to have a special atom member for typed atomref's like ForwardTypedRef or something.

frmdstryr commented 9 months ago

Nevermind, fixed by atom 0.10.2

MatthieuDartiailh commented 9 months ago

Good