mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
e600f9aebb
This commit updates default memory allocations size used with MEM_ROOT objects to minimize 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 account 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 slightly more memory, but avoids memory fragmentation and is slightly faster thanks to much fewer calls to malloc(). Reviewed-by: Sergei Golubchik <serg@mariadb.org> |
||
---|---|---|
.. | ||
crc32 | ||
array.c | ||
base64.c | ||
ChangeLog | ||
charset-def.c | ||
charset.c | ||
CMakeLists.txt | ||
crc32ieee.cc | ||
errors.c | ||
file_logger.c | ||
get_password.c | ||
guess_malloc_library.c | ||
hash.c | ||
lf_alloc-pin.c | ||
lf_dynarray.c | ||
lf_hash.cc | ||
list.c | ||
ma_dyncol.c | ||
mf_arr_appstr.c | ||
mf_cache.c | ||
mf_dirname.c | ||
mf_fn_ext.c | ||
mf_format.c | ||
mf_getdate.c | ||
mf_iocache.c | ||
mf_iocache2.c | ||
mf_keycache.c | ||
mf_keycaches.c | ||
mf_loadpath.c | ||
mf_pack.c | ||
mf_path.c | ||
mf_qsort.c | ||
mf_qsort2.c | ||
mf_radix.c | ||
mf_same.c | ||
mf_sort.c | ||
mf_soundex.c | ||
mf_tempdir.c | ||
mf_tempfile.c | ||
mf_unixpath.c | ||
mf_wcomp.c | ||
mulalloc.c | ||
my_access.c | ||
my_addr_resolve.c | ||
my_alarm.c | ||
my_alloc.c | ||
my_atomic_writes.c | ||
my_basename.c | ||
my_bit.c | ||
my_bitmap.c | ||
my_chmod.c | ||
my_chsize.c | ||
my_compare.c | ||
my_compress.c | ||
my_conio.c | ||
my_copy.c | ||
my_cpu.c | ||
my_create.c | ||
my_default.c | ||
my_delete.c | ||
my_div.c | ||
my_dlerror.c | ||
my_error.c | ||
my_file.c | ||
my_fopen.c | ||
my_fstream.c | ||
my_getexe.c | ||
my_gethwaddr.c | ||
my_getncpus.c | ||
my_getopt.c | ||
my_getpagesize.c | ||
my_getsystime.c | ||
my_getwd.c | ||
my_init.c | ||
my_largepage.c | ||
my_lib.c | ||
my_libwrap.c | ||
my_likely.c | ||
my_lock.c | ||
my_lockmem.c | ||
my_malloc.c | ||
my_memmem.c | ||
my_mess.c | ||
my_minidump.cc | ||
my_mkdir.c | ||
my_mmap.c | ||
my_new.cc | ||
my_once.c | ||
my_open.c | ||
my_port.c | ||
my_pread.c | ||
my_pthread.c | ||
my_quick.c | ||
my_rdtsc.c | ||
my_read.c | ||
my_redel.c | ||
my_rename.c | ||
my_rnd.c | ||
my_safehash.c | ||
my_safehash.h | ||
my_seek.c | ||
my_setuser.c | ||
my_sleep.c | ||
my_stack.c | ||
my_static.c | ||
my_static.h | ||
my_symlink.c | ||
my_symlink2.c | ||
my_sync.c | ||
my_thr_init.c | ||
my_uuid.c | ||
my_win_popen.cc | ||
my_wincond.c | ||
my_winerr.c | ||
my_winfile.c | ||
my_winthread.c | ||
my_wintoken.c | ||
my_write.c | ||
mysys_priv.h | ||
psi_noop.c | ||
ptr_cmp.c | ||
queues.c | ||
safemalloc.c | ||
stacktrace.c | ||
string.c | ||
test_charset.c | ||
test_dir.c | ||
test_thr_mutex.c | ||
test_xml.c | ||
testhash.c | ||
thr_alarm.c | ||
thr_lock.c | ||
thr_mutex.c | ||
thr_rwlock.c | ||
thr_timer.c | ||
tree.c | ||
typelib.c | ||
waiting_threads.c | ||
wqueue.c |