# Interact.jl + Mux.jl + Plots.jl dynamic updating plots memory leak

**URL:** https://discourse.julialang.org/t/interact-jl-mux-jl-plots-jl-dynamic-updating-plots-memory-leak/22390
**Category:** Web Stack
**Tags:** question, plotting
**Created:** [March 27, 2019, 5:19am UTC](https://discourse.julialang.org/t/interact-jl-mux-jl-plots-jl-dynamic-updating-plots-memory-leak/22390 "2019-03-27T05:19:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jesseventura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jesseventura/32/7638_2.png) [@jesseventura](https://discourse.julialang.org/u/jesseventura)
#### Post date: [March 27, 2019, 5:19am UTC](https://discourse.julialang.org/t/interact-jl-mux-jl-plots-jl-dynamic-updating-plots-memory-leak/22390/1 "2019-03-27T05:19:57Z")

</div>

with scripts running in background, i open a browser and see the plot updating, after i close the browser window, memory starts increasing.  
gc’s not work(see the code)

the following shows the problem with Blink(electron) …

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/0/c04f0e3bd98cead4cb3ccc06dec58f48072bbc54.png)

after I close the electron window … electron.exe occurs and the memory keeps going up

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/4/c403e74208291c852cf43b4c8b05d12de25d1000.png)

when i close the windows i noticed that one process of electron.exe exits at the same time  
maybe communication down between electron and the prog

ubuntu16.04/ windows 10  
julia1.0.3/0.7/1.1.0

```julia

using Interact
using Mux
using Colors
using Plots
using Base.GC
#using Blink

#Inspectdr fastest!
inspectdr()

#plotly()
#gr(fmt=:svg)

#unicodeplots()

function get_latest_data(xx::Observable)
    while true
        # memory leak does not relate to this...
        #GC.gc()
        xx[] = (x=1:10000,y=rand(10000))
        #println(x)
        #yield()
        sleep(1)
    end
end

function mycolorpicker(latest_data::Observable)
    # init a plot
    fig = plot(1,1)
    # dynamic update data series
    plt = Interact.@map begin
        fig[1] = ((&latest_data)[:x],(&latest_data)[:y])
        #gui()
        fig
    end
    wdg = Widget(["plt" => plt])
    @layout! wdg hbox(plt, plt) 
end

function main()
    obs = Observable((x=[],y=[]))

    ta = @task get_latest_data(obs)
    schedule(ta)
    println("schedule done")

    ui = mycolorpicker(obs)
    println("render UI done")
    
    # electron also memory leakssss.......
    #w = Window()
    #body!(w, ui)
    
    println("web service starting...")
    WebIO.webio_serve(page("/", req -> ui), 8089)

    while true
        sleep(7)
    end

    # display(ui)
    
end

main()

```

---

<div class="post-metadata">

### Author: ![travigd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/travigd/32/4746_2.png) [@travigd](https://discourse.julialang.org/u/travigd)
#### Post date: [December 28, 2019, 11:26pm UTC](https://discourse.julialang.org/t/interact-jl-mux-jl-plots-jl-dynamic-updating-plots-memory-leak/22390/2 "2019-12-28T23:26:09Z")

</div>

For posterity, this was an issue with WebIO and was fixed.

[https://github.com/JuliaGizmos/WebIO.jl/pull/330](https://github.com/JuliaGizmos/WebIO.jl/pull/330)
