MySQL takes huge memory by ignoring buffer pool size


I am facing a very strange problem, looks like on mysql startup, mysql is taking so much memory than 4x of buffer pool size.

I am using Ubuntu VM (4 Core 8 GB) with MySQL 5.6.33. /etc/mysql/my.cnf is as below:

(client)
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

(mysqld_safe)
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

(mysqld)
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /datafiles/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address        = 0.0.0.0
key_buffer      = 128M
max_allowed_packet  = 128M
thread_stack        = 192K
thread_cache_size       = 8
wait_timeout        = 300
interactive_timeout = 600
max_connect_errors = 1000000
open-files-limit = 1024000
transaction-isolation   = READ-COMMITTED
myisam-recover-options  = BACKUP
max_connections        = 25000
query_cache_limit   = 1M
query_cache_size        = 4M
general_log_file        = /dblogs/audit/general_log.log
general_log             = OFF
log_error = /dblogs/error.log
slow_query_log = ON
slow_query_log_file = /dblogs/SLOW.log
long_query_time =2 
min_examined_row_limit = 5000
server-id       = 1
log_bin         = /dblogs/binarylogs/mysql-bin.log
expire_logs_days    = 10
max_binlog_size   = 10M
binlog_format       = MIXED
innodb_strict_mode = OFF
sql_mode = NO_ENGINE_SUBSTITUTION
innodb_file_format = barracuda
innodb_file_format_max = barracuda
innodb_file_per_table = 1
innodb_data_home_dir        = /datafiles/mysql
innodb_buffer_pool_size = 300M
innodb_buffer_pool_instances = 1
innodb_open_files = 6000
innodb_log_file_size = 512M
innodb_log_buffer_size = 64M
innodb_lock_wait_timeout    = 600
innodb_io_capacity  = 400
innodb_flush_method = O_DSYNC
innodb_flush_log_at_trx_commit = 2
innodb_write_io_threads = 2
innodb_read_io_threads = 2
innodb_log_files_in_group = 2
innodb_monitor_enable = all
join_buffer_size=256K
sort_buffer_size=256K

(mysqldump)
quick
quote-names
max_allowed_packet  = 16M

(mysql)
#no-auto-rehash # faster start of mysql but no tab completition

(isamchk)
key_buffer      = 16M

!includedir /etc/mysql/conf.d/

As, per config file innodb_buffer_pool_size is set 300M and innodb_buffer_pool_instances is set to 1 (no need, as buffer pool is < 1G). error log file also confirms that buffer pool is set to 300.0M

ERROR.log

2020-09-24 01:50:06 4886 (Note) Plugin 'FEDERATED' is disabled.
2020-09-24 01:50:06 4886 (Note) InnoDB: Using atomics to ref count buffer pool pages
2020-09-24 01:50:06 4886 (Note) InnoDB: The InnoDB memory heap is disabled
2020-09-24 01:50:06 4886 (Note) InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-09-24 01:50:06 4886 (Note) InnoDB: Memory barrier is not used
2020-09-24 01:50:06 4886 (Note) InnoDB: Compressed tables use zlib 1.2.8
2020-09-24 01:50:06 4886 (Note) InnoDB: Using Linux native AIO
2020-09-24 01:50:06 4886 (Note) InnoDB: Using CPU crc32 instructions
2020-09-24 01:50:06 4886 (Note) InnoDB: Initializing buffer pool, size = 300.0M
2020-09-24 01:50:06 4886 (Note) InnoDB: Completed initialization of buffer pool
2020-09-24 01:50:06 4886 (Note) InnoDB: Highest supported file format is Barracuda.
2020-09-24 01:50:06 4886 (Note) InnoDB: 128 rollback segment(s) are active.
2020-09-24 01:50:06 4886 (Note) InnoDB: Waiting for purge to start
2020-09-24 01:50:06 4886 (Note) InnoDB: 5.6.33 started; log sequence number 4529735
2020-09-24 01:50:06 4886 (Note) Server hostname (bind-address): '0.0.0.0'; port: 3306
2020-09-24 01:50:06 4886 (Note)   - '0.0.0.0' resolves to '0.0.0.0';
2020-09-24 01:50:06 4886 (Note) Server socket created on IP: '0.0.0.0'.
2020-09-24 01:50:06 4886 (Note) Event Scheduler: Loaded 0 events
2020-09-24 01:50:06 4886 (Note) /usr/sbin/mysqld: ready for connections.
Version: '5.6.33-0ubuntu0.14.04.1-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

even more show global variables like '%pool%'; also show that buffer pool is set properly:

+-------------------------------------+----------------+
| Variable_name                       | Value          |
+-------------------------------------+----------------+
| innodb_additional_mem_pool_size     | 8388608        |
| innodb_buffer_pool_dump_at_shutdown | OFF            |
| innodb_buffer_pool_dump_now         | OFF            |
| innodb_buffer_pool_filename         | ib_buffer_pool |
| innodb_buffer_pool_instances        | 1              |
| innodb_buffer_pool_load_abort       | OFF            |
| innodb_buffer_pool_load_at_startup  | OFF            |
| innodb_buffer_pool_load_now         | OFF            |
| innodb_buffer_pool_size             | 314572800      |
+-------------------------------------+----------------+

But after service start if I check using free -h or in top mysql is taking more than 75% of RAM

             total       used       free     shared    buffers     cached
Mem:          7.5G       5.3G       2.1G        28K       2.8M        77M
-/+ buffers/cache:       5.3G       2.2G
Swap:           9G       1.2G       8.8G

top command output:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 8071 mysql     20   0 6982340 5.741g   9260 S   0.3 77.0   0:02.19 mysqld

I checked by changing innodb_buffer_pool_size to 1G,2G,3G and innodb_buffer_pool_instances to 1,8,10, but irrespective of all these when I start MySQL service 5-6 GB of total RAM (7GB) is taken by Mysql and as soon as I stop the service RAM usages reduced to 224M.

What is this behaviour?
Did I misconfigured the MySQL?
Why Mysql service is taking more than (4x or 8x) of buffer pool size?