HumbleUI / JWM

Cross-platform window management and OS integration library for Java
Apache License 2.0
552 stars 44 forks source link

directContext.abandon(); leaks system resources on Linux #182

Closed dzaima closed 2 years ago

dzaima commented 2 years ago

When the directContext.abandon(); in resize in LayerGLSkija is present, continuously resizing the window will use up more & more RAM. I think abandon is supposed to be called only if the context is already destroyed, but calling it before close makes it think to not even try freeing it?

Linux mint 20.3 Cinnamon, X11

tonsky commented 2 years ago

Interesting!

This is calling this method: https://github.com/google/skia/blob/30fdea3d8fd5ed39de28acae75586d7c4f08ad11/include/gpu/GrDirectContext.h#L135-L152

And destroy on resize comes from https://github.com/google/skia/blob/30fdea3d8fd5ed39de28acae75586d7c4f08ad11/tools/sk_app/GLWindowContext.cpp#L43-L55

I can reproduce it on macOS even! directContext.abandon + resize causes memory consumption to jump through the roof. Let me try to run sk_app from Skia and if I can repro it there I’ll report it to the main repo.

tonsky commented 2 years ago

Ok, seems to be reproducible in sk_app as well. Reported here https://bugs.chromium.org/p/skia/issues/detail?id=12814