Memory Leak - how to diagnose?

Currently runing HA 2022.5.0 on a Pi4.

I have had a problem for over a month now, where “very often” there is a memory leak and the system crashes - becomes super slow, unresponsive. See attached graph. This will happen easily once a day, but I have not seen a consistent pattern.

Can anyone advise how to start investigating a memory leak? I have looked at the logs, but only the logs since last reboot are shown, how does one see logs prior to reboot?

Is there a linux command I can run to see which process is using all the ram, to help narrow it down?

Duplicate of: