title: MySQL (MariaDB) error : Out of memory (needed 1048584 bytes)
body: <p>I am using MySQL DB on Windows 2012 R2, x64 with 8 GB RAM. MySQL database many times shows the error - Out of Memory (needed 1048584 bytes). Below are the database Variable values i have set in my.ini file. Is there any change is required in this file?</p>
  
  <pre><code>[mysqld]
  port= 3306
  socket = "C:/xampp/mysql/mysql.sock"
  basedir = "C:/xampp/mysql" 
  tmpdir = "C:/xampp/tmp" 
  datadir = "C:/xampp/mysql/data"
  pid_file = "mysql.pid"
  
  # enable-named-pipe
  key_buffer_size = 16M
  max_allowed_packet = 256M
  table_cache = 256
  net_buffer_length = 1M
  read_buffer_size = 512K
  read_rnd_buffer_size = 512K
  myisam_sort_buffer_size = 8M
  log_error = "mysql_error.log"
  # Change here for bind listening
  # bind-address="127.0.0.1" 
  # bind-address = ::1    # for ipv6
  max_connect_errors = 500
  max_connections = 5000
  net_write_timeout = 1800
  net_read_timeout = 1800
  slow_launch_time = 10
  slow_query_log = OFF
  thread_cache_size = 2000
  back_log = 100
  performance_schema = OFF
  query_cache_size = 512M
  query_cache_limit = 5M
  join_buffer_size = 4M
  sort_buffer_size = 4M
  max_heap_table_size = 64M
  tmp_table_size = 128M
  table_open_cache = 4500
  table_definition_cache=4000
  innodb_file_per_table=1
  open_files_limit=50000
  innodb_data_home_dir = "C:/xampp/mysql/data"
  innodb_data_file_path = ibdata1:10M:autoextend
  innodb_log_group_home_dir = "C:/xampp/mysql/data"
  #innodb_log_arch_dir = "C:/xampp/mysql/data"
  ## You can set .._buffer_pool_size up to 50 - 80 %
  ## of RAM but beware of setting memory usage too high
  innodb_buffer_pool_size = 2048M
  innodb_buffer_pool_instances = 2
  ## Set .._log_file_size to 25 % of buffer pool size
  innodb_log_file_size = 256M
  innodb_log_buffer_size = 8M
  innodb_flush_log_at_trx_commit = 2
  innodb_lock_wait_timeout = 50
  innodb_flush_method=O_DIRECT
  innodb_io_capacity=1000
  innodb_old_blocks_time=1000
  innodb_open_files=5000
  innodb_sort_buffer_size = 8M
  </code></pre>
  
  <p>Please reply if someone can manage to get this working again!
  Thanks in advance.</p>