diff options
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r-- | sql/sql_udf.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 35c799d4a86..38328c91db3 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -110,6 +110,8 @@ extern "C" uchar* get_hash_key(const uchar *buff, size_t *length, return (uchar*) udf->name.str; } +static PSI_memory_key key_memory_udf_mem; + #ifdef HAVE_PSI_INTERFACE static PSI_rwlock_key key_rwlock_THR_LOCK_udf; @@ -118,6 +120,11 @@ static PSI_rwlock_info all_udf_rwlocks[]= { &key_rwlock_THR_LOCK_udf, "THR_LOCK_udf", PSI_FLAG_GLOBAL} }; +static PSI_memory_info all_udf_memory[]= +{ + { &key_memory_udf_mem, "udf_mem", PSI_FLAG_GLOBAL} +}; + static void init_udf_psi_keys(void) { const char* category= "sql"; @@ -128,6 +135,9 @@ static void init_udf_psi_keys(void) count= array_elements(all_udf_rwlocks); PSI_server->register_rwlock(category, all_udf_rwlocks, count); + + count= array_elements(all_udf_memory); + mysql_memory_register(category, all_udf_memory, count); } #endif @@ -154,10 +164,11 @@ void udf_init() mysql_rwlock_init(key_rwlock_THR_LOCK_udf, &THR_LOCK_udf); - init_sql_alloc(&mem, "udf", UDF_ALLOC_BLOCK_SIZE, 0, MYF(0)); + init_sql_alloc(key_memory_udf_mem, &mem, UDF_ALLOC_BLOCK_SIZE, 0, MYF(0)); THD *new_thd = new THD(0); if (!new_thd || - my_hash_init(&udf_hash,system_charset_info,32,0,0,get_hash_key, NULL, 0)) + my_hash_init(&udf_hash,system_charset_info,32,0,0,get_hash_key, NULL, 0, + key_memory_udf_mem)) { sql_print_error("Can't allocate memory for udf structures"); my_hash_free(&udf_hash); |