mirror of
https://github.com/MariaDB/server.git
synced 2025-07-12 14:28:13 +02:00
![]() This commit updates default memory allocations size used with MEM_ROOT objects to minumize the number of calls to malloc(). Changes: - Updated MEM_ROOT block sizes in sql_const.h - Updated MALLOC_OVERHEAD to also take into account the extra memory allocated by my_malloc() - Updated init_alloc_root() to only take MALLOC_OVERHEAD into acount as buffer size, not MALLOC_OVERHEAD + sizeof(USED_MEM). - Reset mem_root->first_block_usage if and only if first block was used. - Increase MEM_ROOT buffers sized used by my_load_defaults, plugin_init, Create_tmp_table, allocate_table_share, TABLE and TABLE_SHARE. This decreases number of malloc calls during queries. - Use a small buffer for THD->main_mem_root in THD::THD. This avoids multiple malloc() call for new connections. I tried the above changes on a complex select query with 12 tables. The following shows the number of extra allocations that where used to increase the size of the MEM_ROOT buffers. Original code: - Connection to MariaDB: 9 allocations - First query run: 146 allocations - Second query run: 24 allocations Max memory allocated for thd when using with heap table: 61,262,408 Max memory allocated for thd when using Aria tmp table: 419,464 After changes: Connection to MariaDB: 0 allocations - First run: 25 allocations - Second run: 7 allocations Max memory allocated for thd when using with heap table: 61,347,424 Max memory allocated for thd when using Aria table: 529,168 The new code uses slighly more memory, but avoids memory fragmentation and is slighly faster thanks to much fewer calls to malloc(). |
||
---|---|---|
.. | ||
archive | ||
atomic | ||
binlog | ||
binlog_encryption | ||
client | ||
compat | ||
csv | ||
encryption | ||
engines | ||
federated | ||
funcs_1 | ||
funcs_2 | ||
galera | ||
galera_3nodes | ||
galera_3nodes_sr | ||
galera_sr | ||
gcol | ||
handler | ||
heap | ||
innodb | ||
innodb_fts | ||
innodb_gis | ||
innodb_i_s | ||
innodb_zip | ||
jp | ||
json | ||
large_tests | ||
maria | ||
mariabackup | ||
mtr/t | ||
mtr2 | ||
multi_source | ||
optimizer_unfixed_bugs | ||
parts | ||
perfschema | ||
perfschema_stress | ||
period | ||
plugins | ||
roles | ||
rpl | ||
s3 | ||
sql_sequence | ||
storage_engine | ||
stress | ||
sys_vars | ||
sysschema | ||
unit | ||
vcol | ||
versioning | ||
wsrep |