Browser side memory leaks using InteractNext.jl

Hello, I’m having an issue with browser side memory leaks when using the InteractNext.jl (https://github.com/JuliaGizmos/InteractNext.jl) package. Running the svg example (the first example in the readme) and serving it with Mux causes memory leaks in the browser (or in electron if served with Blink) after playing around with the widgets for a while. In Chrome, the page crashes after using ~1.5GB of memory. Has anyone else encountered this issue and managed to solve it? Any help or pointers would be appreciated.

Edit: This was caused by WebIO.newid being run each time the graphic was updated. I managed to solve it by overwriting the WebIO.newid function to reuse old id names.

2 Likes

pretty cool that you figured out the problem! I guess we need to address this before releasing. At least in @manipulate we should try and reuse widget context. @jobjob

I came up with a solution that fits my purposes better and thought I’d share it in case you have any use for it. Naming a node will force the container to retain the id. I added the following to the Base.show function from node.jl in WebIO.


if haskey(x.props, :id)
		id = "$(x.props[:id])-parent"
else
		id = WebIO.newid("node")
end
1 Like

Thanks, that definitely helps! I suspect the problem is with mounting a Vue instance on elements with new ids every time.