1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug#25175 Too much memory used by MySQL grant system

Each time the server reloads privileges containing table grants, the 
system will allocate too much memory than needed because of badly
chosen growth prediction in the underlying dynamic arrays.

This patch introduces a new signature to the hash container initializer
which enables a much more pessimistic approach in favour for more
efficient memory useage.

This patch was supplied by Google Inc.
This commit is contained in:
thek@adventure.(none)
2008-03-18 10:45:36 +01:00
parent 31ff514ea2
commit cee1b1fd99
3 changed files with 9 additions and 7 deletions

View File

@ -2281,7 +2281,7 @@ GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
const char *t, ulong p, ulong c)
:GRANT_NAME(h,d,u,t,p), cols(c)
{
(void) hash_init(&hash_columns,system_charset_info,
(void) hash_init2(&hash_columns,4,system_charset_info,
0,0,0, (hash_get_key) get_key_column,0,0);
}
@ -2329,7 +2329,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
cols= (ulong) form->field[7]->val_int();
cols = fix_rights_for_column(cols);
(void) hash_init(&hash_columns,system_charset_info,
(void) hash_init2(&hash_columns,4,system_charset_info,
0,0,0, (hash_get_key) get_key_column,0,0);
if (cols)
{