Makie memory leak?

Hi,

I do not understand why the following MWE consumes more an more memory until crash:

 using GLMakie,AbstractPlotting,ImageCore
function leak(img,i)
    fn=string(i)*".png"
    scene = AbstractPlotting.image(rotr90(img), show_axis = false);
    AbstractPlotting.save(fn, scene; resolution = (1920,1088), px_per_unit = 72)
    nothing
end

function nleak(nf)
    nx,ny=1920,1088

    for i=1:nf
        img = rand(RGB{N0f8}, nx, ny)
        leak(img,i)
        @info "Size of AbstractPlotting: $(Base.format_bytes(Base.summarysize(AbstractPlotting)))"
        GC.gc(true)
    end
end
nleak(200)

Any hints ?

Maybe you plot many images into the same scene. I dont remember its behaviour…

I don’t know. The calling nleak function does not create any Makie related object. Hence I would assume that every Makie objects should be destroyed (or ready for GC) at the leak function exit…

What version are you on? Can you try with latest AbstractPlotting /GLMakie? Something similar was supposed to be fixed recently

Hi, I think that my system is up to date:

Status `~/Projects/video_grid.jl/MWE/Project.toml`
  [537997a7] AbstractPlotting v0.14.3
  [3da002f7] ColorTypes v0.10.9
  [5ae59095] Colors v0.12.5
  [e9467ef8] GLMakie v0.1.21
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "/snap/code/52/usr/share/code/code"
  JULIA_NUM_THREADS = 

I also try to use the master version with the same outcome:

(MWE) pkg> status
Status `~/Projects/video_grid.jl/MWE/Project.toml`
  [537997a7] AbstractPlotting v0.14.3 `https://github.com/JuliaPlots/AbstractPlotting.jl#master`
  [e9467ef8] GLMakie v0.1.21 `https://github.com/JuliaPlots/GLMakie.jl#master`

Could you please file an issue at Makie.jl with this MWE then? So far these things have been caused by lingering observable connections, and they tend to be hard to catch

1 Like

Just a wild guess, sorry if it is misleading, but can it be related to https://github.com/JuliaLang/julia/issues/14495?

1 Like

Yeah Makie had a couple of problems lately, which is why I created https://github.com/SimonDanisch/MemoryHunter.jl… I’ll take a look at your mwe once I have time!

3 Likes

OK thank you for your answer… and good luck with the investigation !
I was not sure since the memory leak issues I have found on github were closed.
Should I post a new issue ?

The issue is here
https://github.com/JuliaPlots/Makie.jl/issues/795#issue-774762968

BTW, is it possible (useful) to plot CuArrays with Makie ?