-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
empty!
the GLMakie screen for reuse instead of close
ing and reopening
#3881
base: master
Are you sure you want to change the base?
Conversation
This is likely not correct and can't be merged like this, but good to know that this fixes it... |
|
The second commit caused an accumulation of screens and therefore a ballooning memory use. The latest commit simplifies by just copying what seems to be the only line in the |
bc071b3
to
8948efc
Compare
The debug output to compare to #2453 (comment) is julia> using GLMakie
julia> ENV["JULIA_DEBUG"] = "GLMakie"
"GLMakie"
julia> scatter(rand(10))
┌ Debug: new singleton screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:328
┌ Debug: reopening screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:295
┌ Debug: Applying screen config! to existing screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:341
┌ Debug: display scene on screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:407
julia> scatter(rand(10))
┌ Debug: reusing singleton screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:323
┌ Debug: Leaving renderloop, cause: stopped renderloop
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:953
┌ Debug: empty screen!
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:570
┌ Debug: reopening screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:295
┌ Debug: Applying screen config! to existing screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:341
┌ Debug: display scene on screen
└ @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:407 |
8948efc
to
9bed591
Compare
9bed591
to
df687a8
Compare
98dc4d6
to
3330ebf
Compare
3330ebf
to
ec33d87
Compare
ec33d87
to
e33b8d2
Compare
e33b8d2
to
a5f246e
Compare
…ning This fixes a problem observed on Linux (across at least a couple of different desktop environments) with windows flashing away and coming back in a different place (can be a different monitor!) when reusing the shared singleton screen. Also, wait for renderloop task to stop before restoring `close_after_renderloop` value. Without this, one can observe that the singleton window is fully closed and reopened by applying the following patch: ```diff diff --git a/GLMakie/src/screen.jl b/GLMakie/src/screen.jl index ff8b69fdc..e18b8ba6b 100644 --- a/GLMakie/src/screen.jl +++ b/GLMakie/src/screen.jl @@ -839,6 +839,7 @@ function pause_renderloop!(screen::Screen) end function stop_renderloop!(screen::Screen; close_after_renderloop=screen.close_after_renderloop) + yield() # don't double close when stopping renderloop c = screen.close_after_renderloop screen.close_after_renderloop = close_after_renderloop @@ -974,7 +975,7 @@ function renderloop(screen) end if screen.close_after_renderloop try - @debug("Closing screen after quiting renderloop!") + @info("Closing screen after quiting renderloop!") close(screen) catch e @warn "error closing screen" exception=(e, Base.catch_backtrace()) ``` which aims to force the renderloop's task to run via the call to `yield()` so that the task is sleeping during the rest of the function call. (The logging change just makes the particular action easier to find than enabling debug-level logging.) Opening a plot and replotting at the REPL, I observe both the window quickly close and reappear and the log message being printed by the end of the renderloop: ```julia-repl julia> using GLMakie Precompiling GLMakie Info Given GLMakie was explicitly requested, output will be shown live [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! [ Info: Closing screen after quiting renderloop! 1 dependency successfully precompiled in 21 seconds. 303 already precompiled. 1 dependency had output during precompilation: ┌ GLMakie │ [Output was shown above] └ julia> scatter([1, 6]) julia> scatter([1, 6]) [ Info: Closing screen after quiting renderloop! ``` With the changes in this commit, all of the log message disappear, including from the precompile process.
a5f246e
to
549a1c8
Compare
Description
Fixes #2453
This fixes a problem observed on Linux (across at least a couple of different desktop environments) with windows flashing away and coming back in a different place (can be a different monitor!) when reusing the shared singleton screen.
Type of change