In EasyEffects(and PulseEffects) I use --gappplication-service to keep the application running in background once its window is closed. It works but when the window is closed I never see a decrease in the memory used by the application(measured in gnome system monitor). It does not seem that there is a leak. If I close and open the window multiple times the memory usage is essentially the same within some small fluctuation. It is almost like gtk is caching something related to the widgets. Is there something special that has to be done when using --gapplication-service or is this the way gtk3/gtk4 handles memory?
I can’t say for certain what is happening without profiling, but usual behavior of glibc malloc is to avoid releasing memory back to the OS unless the allocation is large. This is tunable by the application, see here, here, here. Also you could try that with G_SLICE=always-malloc to see if that changes anything.
Setting G_SLICE=always-malloc does not make any difference. After running “easyeffects --gapplication-service” the process memory usage is around 71 MB. And after opening the window it jumps to 165 MB and within a very small fluctuation it stays in this value if all we do is closing and opening the window.
As it does not seem to be leaking memory when closing and opening the window I think there is nothing to be concerned about. It is just weird. Usually when we delete things the memory used by the process decreases. But in this case it seems that under the hoods gtk is keeping the allocations it did before.