MariaDB stops every few hours

For sure. But just giving it more memory is not a fix. Give it all the memory possible and it is still going to fail eventually.

We need to identify the leak, isolate it, and fix it.

Those CPU averages would be a lot higher if it were a systemic leak.
MariaDB is not failing it is being deliberately shut down.

That other topic was resolved by

I asked before - Are any of these VS running WordPress?