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

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) …

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

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


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()


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

https://github.com/JuliaGizmos/WebIO.jl/pull/330

5 Likes