squeak-smalltalk / squeak-object-memory

Issues and assets related to the Squeak object memory.
https://bugs.squeak.org
MIT License
11 stars 1 forks source link

Images sometime after update 20981 leak memory on X11 displays #51

Closed edoneel closed 2 years ago

edoneel commented 2 years ago

https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/642 has lots of details, but it is not a VM issue. Rather this issue started with an update between 20981 and 21617.

The short summary is that when you run Squeak actually displaying on an X11 display the RSS of the process increases somewhat quickly.

The same image/VM run headless does not have this problem. Raspberry PI OS both 32 and 64 bit systems also do not have this problem.

The current guess is that from the image side we are calling into the display driver to do something, and, on the X11 driver this call allocates something and there is not the corresponding call from the image side to deallocate that thing.

edoneel commented 2 years ago

So - Sometime this spring between change 20981 and change 21617 there were changes made to the screen resolution code that changed how often, it seems, we call display_ioScreenScaleFactor. Before it must have been rarely called like on startup and resize or whatever and now it is called often, sometimes many times per second.

The X11 code, being X11 code for Linux, has multiple ways of getting the screen scale factor. Which path was followed depended on some things but on assorted Ubuntu systems the path followed called scale_Xftdpi_usable. This called XrmGetStringDatabase every time it entered but if Xft.dpi was there then it returned without calling XrmDestroyDatabase. Ergo the memory leaked.

The patch is in the OpenSmalltalk/opensmalltalk-vm issue 642.