MariaDB memory use rises beyond configured size

Solution 1:

With credit for the forumla due to Gordon's answer and the link therein, the following command will tell you how much your MySQL/MariaDB database needs:

SELECT ROUND(
    ( @@GLOBAL.key_buffer_size                     
     + @@GLOBAL.query_cache_size 
     + @@GLOBAL.tmp_table_size 
     + @@GLOBAL.innodb_buffer_pool_size 
     + @@GLOBAL.innodb_log_buffer_size 
     + @@GLOBAL.max_connections * ( 
         @@GLOBAL.sort_buffer_size
       + @@GLOBAL.read_buffer_size 
       + @@GLOBAL.read_rnd_buffer_size 
       + @@GLOBAL.join_buffer_size 
       + @@GLOBAL.thread_stack 
       + @@GLOBAL.binlog_cache_size)
    ) / 1024 / 1024, 1) `total MB`;

(I am the OP and this gives 2.9GB as my total configured usage - time to lower some figures!)

Solution 2:

The memory settings you listed are shared. There are also various buffers that are allocated per thread. Here is a link to a MySQL memory calculator:

https://www.mysqlcalculator.com/