Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Memory leak #351

Open
cstjean opened this issue Feb 4, 2020 · 3 comments
Open

Memory leak #351

cstjean opened this issue Feb 4, 2020 · 3 comments
Labels

Comments

@cstjean
Copy link

cstjean commented Feb 4, 2020

On Interact v0.10.3, Julia 1.3.1, the following code leaks memory:

julia> using Interact

julia> function gui()
           f = rand(100_000_000)
           dropd = Widgets.dropdown(["a", "b"])
           on(dropd) do _
               println(maximum(f))
           end
           dropd
       end
gui (generic function with 2 methods)

julia> nothing; gui(); 1
1

julia> nothing; gui(); 1
1

...

Memory usage goes up after each call, even after GC.gc().

@cstjean
Copy link
Author

cstjean commented Feb 4, 2020

julia> function mk_obs()
           f = rand(100_000_000)
           obs = Observable(0)
           on(obs) do _
               println(maximum(f))
           end
           obs
       end
mk_obs (generic function with 1 method)

does not leak memory, so it's something about the widgets. Is anything holding a reference to it? With the dropdown,

julia> WebIO.observ_id_dict
WeakKeyDict{Any,Any} with 2 entries:
  Observable{Any} with 2 l => (WeakRef(Scope(Node{DOM}(DOM(:html, :div), Any[N
  Observable{Any} with 1 l => (WeakRef(Scope(Node{DOM}(DOM(:html, :div), Any[N

after GC.

@cstjean
Copy link
Author

cstjean commented Feb 4, 2020

I'm guessing it's some variant of https://discourse.julialang.org/t/weakkeydict-x-x-holds-on-to-memory/34187.

@twavv
Copy link
Member

twavv commented Feb 5, 2020

Yeah, this is essentially just JuliaGizmos/WebIO.jl#321.

It's being tackled in JuliaGizmos/WebIO.jl#368, but my day job has picked up and I haven't had the time to work on it recently.

@twavv twavv added the upstream label Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants