How to debug memory leaks

It looks something leaks slab memory causing oom killing mariadb process. I have a standard setup of nginx, php-fpm and mariadb. Their processes do not use too much memory (as top shows) and stopping them expectedly does not release much memory.

Try valgrind. It’s available in a certain bundle.

http://www.phpinternalsbook.com/php7/memory_management/memory_debugging.html

the OOM killer kills the process that is likely allocating lots of memory when there is nothing left. It doesn’t know very well which process is leaking memory.

If restarting mariadb doesn’t return the memory, it’s not the process that is leaking. Try killing the others and seeing if you can identify the culprit. This is usually very difficult, though.