WindowServer process takes a lot of memory

I'm using a MBP 13" 2014 on macOS high Sierra with a 4k monitor.

The memory usage of WindowsServer can go quite high (up to 40 GB).

The only solution I found is to reboot my computer -- as the memory usage never goes down. The problem started with MacOS Sierra I think.

Does someone has a piece of advice or a better solution than rebooting my computer ?

enter image description here

And after closing all the running apps on my computer, it is nearly the same memory usage: enter image description here


Solution 1:

According to this article this appears to be a bug in the system when used with a Scaled Display resolution

This seems to be a bug with scaled screen resolution (specially with 4K monitors) in MacOS High Seirra (and perhaps in older versions of the OS as well). Using "Default for display" screen resolution seems to fix the issue (Not my ideal resolution, but a temporary fix until an MacOS update with a fix is available). More information here: https://www.tonymacx86.com/threads/windowserver-memory-leak-on-high-sierra.233510/

I am using a scaled (external) display and I am facing a similar problem which is what led me to this topic.