MacOS memory leak WindowServer

I’ve been watching the processes in Activity monitor. I use an imac with 580 video card.
I noticed the “WindowServer” process slowly growing to use up to 1gb RAM and then crashing at some point. This requires me to enter my password but does not crash the computer most of the time. “kernel_task” also grew quite a bit during one session.
I’m not sure if this is an Apple problem but I think it is. I also noted it on my website as I have some connections. Just writing down my findings here in case anyone else has a similar problem.