mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
perfschema memory related instrumentation changes
This commit is contained in:
parent
2ac3121af2
commit
7c58e97bf6
307 changed files with 2622 additions and 1743 deletions
|
@ -41,15 +41,15 @@ uint hashpjw(const char *arKey, uint nKeyLength)
|
|||
|
||||
int completion_hash_init(HashTable *ht, uint nSize)
|
||||
{
|
||||
ht->arBuckets = (Bucket **) my_malloc(nSize* sizeof(Bucket *),
|
||||
MYF(MY_ZEROFILL | MY_WME));
|
||||
ht->arBuckets = (Bucket **) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
nSize* sizeof(Bucket *), MYF(MY_ZEROFILL | MY_WME));
|
||||
|
||||
if (!ht->arBuckets)
|
||||
{
|
||||
ht->initialized = 0;
|
||||
return FAILURE;
|
||||
}
|
||||
init_alloc_root(&ht->mem_root, "completion_hash", 8192, 0, MYF(0));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &ht->mem_root, 8192, 0, MYF(0));
|
||||
ht->pHashFunction = hashpjw;
|
||||
ht->nTableSize = nSize;
|
||||
ht->initialized = 1;
|
||||
|
|
|
@ -1133,10 +1133,10 @@ int main(int argc,char *argv[])
|
|||
charset_index= get_command_index('C');
|
||||
delimiter_index= get_command_index('d');
|
||||
delimiter_str= delimiter;
|
||||
default_prompt = my_strdup(getenv("MYSQL_PS1") ?
|
||||
default_prompt = my_strdup(PSI_NOT_INSTRUMENTED, getenv("MYSQL_PS1") ?
|
||||
getenv("MYSQL_PS1") :
|
||||
"\\N [\\d]> ",MYF(MY_WME));
|
||||
current_prompt = my_strdup(default_prompt,MYF(MY_WME));
|
||||
current_prompt = my_strdup(PSI_NOT_INSTRUMENTED, default_prompt,MYF(MY_WME));
|
||||
prompt_counter=0;
|
||||
aborted= 0;
|
||||
sf_leaking_memory= 1; /* no memory leak reports yet */
|
||||
|
@ -1204,7 +1204,7 @@ int main(int argc,char *argv[])
|
|||
sf_leaking_memory= 0;
|
||||
glob_buffer.realloc(512);
|
||||
completion_hash_init(&ht, 128);
|
||||
init_alloc_root(&hash_mem_root, "hash", 16384, 0, MYF(0));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &hash_mem_root, 16384, 0, MYF(0));
|
||||
if (sql_connect(current_host,current_db,current_user,opt_password,
|
||||
opt_silent))
|
||||
{
|
||||
|
@ -1246,12 +1246,11 @@ int main(int argc,char *argv[])
|
|||
{
|
||||
/* read-history from file, default ~/.mysql_history*/
|
||||
if (getenv("MYSQL_HISTFILE"))
|
||||
histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME));
|
||||
histfile=my_strdup(PSI_NOT_INSTRUMENTED, getenv("MYSQL_HISTFILE"),MYF(MY_WME));
|
||||
else if (getenv("HOME"))
|
||||
{
|
||||
histfile=(char*) my_malloc((uint) strlen(getenv("HOME"))
|
||||
+ (uint) strlen("/.mysql_history")+2,
|
||||
MYF(MY_WME));
|
||||
histfile=(char*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
strlen(getenv("HOME")) + strlen("/.mysql_history")+2, MYF(MY_WME));
|
||||
if (histfile)
|
||||
sprintf(histfile,"%s/.mysql_history",getenv("HOME"));
|
||||
char link_name[FN_REFLEN];
|
||||
|
@ -1273,8 +1272,8 @@ int main(int argc,char *argv[])
|
|||
if (verbose)
|
||||
tee_fprintf(stdout, "Reading history-file %s\n",histfile);
|
||||
read_history(histfile);
|
||||
if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5,
|
||||
MYF(MY_WME))))
|
||||
if (!(histfile_tmp= (char*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
strlen(histfile) + 5, MYF(MY_WME))))
|
||||
{
|
||||
fprintf(stderr, "Couldn't allocate memory for temp histfile!\n");
|
||||
exit(1);
|
||||
|
@ -1810,7 +1809,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
|
|||
}
|
||||
if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
|
||||
!(embedded_server_args[embedded_server_arg_count++]=
|
||||
my_strdup(argument, MYF(MY_FAE))))
|
||||
my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE))))
|
||||
{
|
||||
put_info("Can't use server argument", INFO_ERROR);
|
||||
return 0;
|
||||
|
@ -1846,7 +1845,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
|
|||
{
|
||||
char *start= argument;
|
||||
my_free(opt_password);
|
||||
opt_password= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; // Destroy argument
|
||||
if (*start)
|
||||
start[1]=0 ;
|
||||
|
@ -1909,7 +1908,7 @@ static int get_options(int argc, char **argv)
|
|||
|
||||
tmp= (char *) getenv("MYSQL_HOST");
|
||||
if (tmp)
|
||||
current_host= my_strdup(tmp, MYF(MY_WME));
|
||||
current_host= my_strdup(PSI_NOT_INSTRUMENTED, tmp, MYF(MY_WME));
|
||||
|
||||
pagpoint= getenv("PAGER");
|
||||
if (!((char*) (pagpoint)))
|
||||
|
@ -1951,7 +1950,7 @@ static int get_options(int argc, char **argv)
|
|||
{
|
||||
skip_updates= 0;
|
||||
my_free(current_db);
|
||||
current_db= my_strdup(*argv, MYF(MY_WME));
|
||||
current_db= my_strdup(PSI_NOT_INSTRUMENTED, *argv, MYF(MY_WME));
|
||||
}
|
||||
if (tty_password)
|
||||
opt_password= get_tty_password(NullS);
|
||||
|
@ -2975,7 +2974,7 @@ static void get_current_db()
|
|||
{
|
||||
MYSQL_ROW row= mysql_fetch_row(res);
|
||||
if (row && row[0])
|
||||
current_db= my_strdup(row[0], MYF(MY_WME));
|
||||
current_db= my_strdup(PSI_NOT_INSTRUMENTED, row[0], MYF(MY_WME));
|
||||
mysql_free_result(res);
|
||||
}
|
||||
}
|
||||
|
@ -4331,12 +4330,12 @@ com_connect(String *buffer, char *line)
|
|||
if (tmp && *tmp)
|
||||
{
|
||||
my_free(current_db);
|
||||
current_db= my_strdup(tmp, MYF(MY_WME));
|
||||
current_db= my_strdup(PSI_NOT_INSTRUMENTED, tmp, MYF(MY_WME));
|
||||
tmp= get_arg(buff, GET_NEXT);
|
||||
if (tmp)
|
||||
{
|
||||
my_free(current_host);
|
||||
current_host=my_strdup(tmp,MYF(MY_WME));
|
||||
current_host=my_strdup(PSI_NOT_INSTRUMENTED, tmp,MYF(MY_WME));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4521,7 +4520,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
|
|||
return put_error(&mysql);
|
||||
}
|
||||
my_free(current_db);
|
||||
current_db=my_strdup(tmp,MYF(MY_WME));
|
||||
current_db=my_strdup(PSI_NOT_INSTRUMENTED, tmp,MYF(MY_WME));
|
||||
#ifdef HAVE_READLINE
|
||||
if (select_db > 1)
|
||||
build_completion_hash(opt_rehash, 1);
|
||||
|
@ -4929,7 +4928,7 @@ server_version_string(MYSQL *con)
|
|||
/* version, space, comment, \0 */
|
||||
size_t len= strlen(mysql_get_server_info(con)) + strlen(cur[0]) + 2;
|
||||
|
||||
if ((server_version= (char *) my_malloc(len, MYF(MY_WME))))
|
||||
if ((server_version= (char *) my_malloc(PSI_NOT_INSTRUMENTED, len, MYF(MY_WME))))
|
||||
{
|
||||
char *bufp;
|
||||
bufp = strmov(server_version, mysql_get_server_info(con));
|
||||
|
@ -4946,7 +4945,7 @@ server_version_string(MYSQL *con)
|
|||
*/
|
||||
|
||||
if (server_version == NULL)
|
||||
server_version= my_strdup(mysql_get_server_info(con), MYF(MY_WME));
|
||||
server_version= my_strdup(PSI_NOT_INSTRUMENTED, mysql_get_server_info(con), MYF(MY_WME));
|
||||
}
|
||||
|
||||
return server_version ? server_version : "";
|
||||
|
@ -5348,8 +5347,8 @@ static void init_username()
|
|||
(result=mysql_use_result(&mysql)))
|
||||
{
|
||||
MYSQL_ROW cur=mysql_fetch_row(result);
|
||||
full_username=my_strdup(cur[0],MYF(MY_WME));
|
||||
part_username=my_strdup(strtok(cur[0],"@"),MYF(MY_WME));
|
||||
full_username=my_strdup(PSI_NOT_INSTRUMENTED, cur[0],MYF(MY_WME));
|
||||
part_username=my_strdup(PSI_NOT_INSTRUMENTED, strtok(cur[0],"@"),MYF(MY_WME));
|
||||
(void) mysql_fetch_row(result); // Read eof
|
||||
}
|
||||
}
|
||||
|
@ -5360,7 +5359,7 @@ static int com_prompt(String *buffer __attribute__((unused)),
|
|||
char *ptr=strchr(line, ' ');
|
||||
prompt_counter = 0;
|
||||
my_free(current_prompt);
|
||||
current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME));
|
||||
current_prompt=my_strdup(PSI_NOT_INSTRUMENTED, ptr ? ptr+1 : default_prompt,MYF(MY_WME));
|
||||
if (!ptr)
|
||||
tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt);
|
||||
else
|
||||
|
|
|
@ -191,7 +191,7 @@ static char *get_value(char *line, const char *item)
|
|||
char *s= 0;
|
||||
|
||||
s = line + item_len + 1;
|
||||
destination= my_strndup(s, line_len - start, MYF(MY_FAE));
|
||||
destination= my_strndup(PSI_NOT_INSTRUMENTED, s, line_len - start, MYF(MY_FAE));
|
||||
destination[line_len - item_len - 2]= 0;
|
||||
}
|
||||
return destination;
|
||||
|
@ -259,7 +259,7 @@ static int has_spaces(const char *path)
|
|||
static char *convert_path(const char *argument)
|
||||
{
|
||||
/* Convert / to \\ to make Windows paths */
|
||||
char *winfilename= my_strdup(argument, MYF(MY_FAE));
|
||||
char *winfilename= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
char *pos, *end;
|
||||
size_t length= strlen(argument);
|
||||
|
||||
|
@ -291,7 +291,7 @@ static char *add_quotes(const char *path)
|
|||
else
|
||||
snprintf(windows_cmd_friendly, sizeof(windows_cmd_friendly),
|
||||
"%s", path);
|
||||
return my_strdup(windows_cmd_friendly, MYF(MY_FAE));
|
||||
return my_strdup(PSI_NOT_INSTRUMENTED, windows_cmd_friendly, MYF(MY_FAE));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -376,19 +376,19 @@ static int get_default_values()
|
|||
|
||||
if ((opt_datadir == 0) && ((value= get_value(line, "--datadir"))))
|
||||
{
|
||||
opt_datadir= my_strdup(value, MYF(MY_FAE));
|
||||
opt_datadir= my_strdup(PSI_NOT_INSTRUMENTED, value, MYF(MY_FAE));
|
||||
}
|
||||
if ((opt_basedir == 0) && ((value= get_value(line, "--basedir"))))
|
||||
{
|
||||
opt_basedir= my_strdup(value, MYF(MY_FAE));
|
||||
opt_basedir= my_strdup(PSI_NOT_INSTRUMENTED, value, MYF(MY_FAE));
|
||||
}
|
||||
if ((opt_plugin_dir == 0) && ((value= get_value(line, "--plugin_dir"))))
|
||||
{
|
||||
opt_plugin_dir= my_strdup(value, MYF(MY_FAE));
|
||||
opt_plugin_dir= my_strdup(PSI_NOT_INSTRUMENTED, value, MYF(MY_FAE));
|
||||
}
|
||||
if ((opt_plugin_ini == 0) && ((value= get_value(line, "--plugin_ini"))))
|
||||
{
|
||||
opt_plugin_ini= my_strdup(value, MYF(MY_FAE));
|
||||
opt_plugin_ini= my_strdup(PSI_NOT_INSTRUMENTED, value, MYF(MY_FAE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -497,22 +497,22 @@ get_one_option(const struct my_option *opt,
|
|||
usage();
|
||||
exit(0);
|
||||
case 'd':
|
||||
opt_datadir= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_datadir= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
break;
|
||||
case 'b':
|
||||
opt_basedir= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_basedir= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
break;
|
||||
case 'p':
|
||||
opt_plugin_dir= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_plugin_dir= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
break;
|
||||
case 'i':
|
||||
opt_plugin_ini= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_plugin_ini= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
break;
|
||||
case 'm':
|
||||
opt_mysqld= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_mysqld= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
break;
|
||||
case 'f':
|
||||
opt_my_print_defaults= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_my_print_defaults= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -620,7 +620,7 @@ static int load_plugin_data(char *plugin_name, char *config_file)
|
|||
if (opt_plugin_ini == 0)
|
||||
{
|
||||
fn_format(path, config_file, opt_plugin_dir, "", MYF(0));
|
||||
opt_plugin_ini= my_strdup(path, MYF(MY_FAE));
|
||||
opt_plugin_ini= my_strdup(PSI_NOT_INSTRUMENTED, path, MYF(MY_FAE));
|
||||
}
|
||||
if (!file_exists(opt_plugin_ini))
|
||||
{
|
||||
|
@ -636,7 +636,7 @@ static int load_plugin_data(char *plugin_name, char *config_file)
|
|||
}
|
||||
|
||||
/* save name */
|
||||
plugin_data.name= my_strdup(plugin_name, MYF(MY_WME));
|
||||
plugin_data.name= my_strdup(PSI_NOT_INSTRUMENTED, plugin_name, MYF(MY_WME));
|
||||
|
||||
/* Read plugin components */
|
||||
while (i < 16)
|
||||
|
@ -666,14 +666,14 @@ static int load_plugin_data(char *plugin_name, char *config_file)
|
|||
/* Add proper file extension for soname */
|
||||
strcat(line, FN_SOEXT);
|
||||
/* save so_name */
|
||||
plugin_data.so_name= my_strdup(line, MYF(MY_WME|MY_ZEROFILL));
|
||||
plugin_data.so_name= my_strdup(PSI_NOT_INSTRUMENTED, line, MYF(MY_WME|MY_ZEROFILL));
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(line) > 0)
|
||||
{
|
||||
plugin_data.components[i]= my_strdup(line, MYF(MY_WME));
|
||||
plugin_data.components[i]= my_strdup(PSI_NOT_INSTRUMENTED, line, MYF(MY_WME));
|
||||
i++;
|
||||
}
|
||||
else
|
||||
|
@ -739,21 +739,21 @@ static int check_options(int argc, char **argv, char *operation)
|
|||
else if ((strncasecmp(argv[i], basedir_prefix, basedir_len) == 0) &&
|
||||
!opt_basedir)
|
||||
{
|
||||
opt_basedir= my_strndup(argv[i]+basedir_len,
|
||||
opt_basedir= my_strndup(PSI_NOT_INSTRUMENTED, argv[i]+basedir_len,
|
||||
strlen(argv[i])-basedir_len, MYF(MY_FAE));
|
||||
num_found++;
|
||||
}
|
||||
else if ((strncasecmp(argv[i], datadir_prefix, datadir_len) == 0) &&
|
||||
!opt_datadir)
|
||||
{
|
||||
opt_datadir= my_strndup(argv[i]+datadir_len,
|
||||
opt_datadir= my_strndup(PSI_NOT_INSTRUMENTED, argv[i]+datadir_len,
|
||||
strlen(argv[i])-datadir_len, MYF(MY_FAE));
|
||||
num_found++;
|
||||
}
|
||||
else if ((strncasecmp(argv[i], plugin_dir_prefix, plugin_dir_len) == 0) &&
|
||||
!opt_plugin_dir)
|
||||
{
|
||||
opt_plugin_dir= my_strndup(argv[i]+plugin_dir_len,
|
||||
opt_plugin_dir= my_strndup(PSI_NOT_INSTRUMENTED, argv[i]+plugin_dir_len,
|
||||
strlen(argv[i])-plugin_dir_len, MYF(MY_FAE));
|
||||
num_found++;
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ static int process_options(int argc, char *argv[], char *operation)
|
|||
#endif
|
||||
buff[sizeof(buff) - 1]= 0;
|
||||
my_free(opt_basedir);
|
||||
opt_basedir= my_strdup(buff, MYF(MY_FAE));
|
||||
opt_basedir= my_strdup(PSI_NOT_INSTRUMENTED, buff, MYF(MY_FAE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
|
|||
{
|
||||
char *start=argument;
|
||||
my_free(opt_password);
|
||||
opt_password=my_strdup(argument,MYF(MY_FAE));
|
||||
opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
if (*start)
|
||||
start[1]=0; /* Cut length of argument */
|
||||
|
@ -1357,11 +1357,11 @@ static char **mask_password(int argc, char ***argv)
|
|||
if (!argc)
|
||||
return NULL;
|
||||
|
||||
temp_argv= (char **)(my_malloc(sizeof(char *) * argc, MYF(MY_WME)));
|
||||
temp_argv= (char **)(my_malloc(PSI_NOT_INSTRUMENTED, sizeof(char *) * argc, MYF(MY_WME)));
|
||||
argc--;
|
||||
while (argc > 0)
|
||||
{
|
||||
temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE));
|
||||
temp_argv[argc]= my_strdup(PSI_NOT_INSTRUMENTED, (*argv)[argc], MYF(MY_FAE));
|
||||
if (find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_PASSWORD ||
|
||||
find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_OLD_PASSWORD)
|
||||
{
|
||||
|
@ -1374,7 +1374,7 @@ static char **mask_password(int argc, char ***argv)
|
|||
}
|
||||
argc--;
|
||||
}
|
||||
temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE));
|
||||
temp_argv[argc]= my_strdup(PSI_NOT_INSTRUMENTED, (*argv)[argc], MYF(MY_FAE));
|
||||
return(temp_argv);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,9 @@
|
|||
extern "C" unsigned char *mysql_net_store_length(unsigned char *packet, size_t length);
|
||||
#define net_store_length mysql_net_store_length
|
||||
|
||||
#define key_memory_TABLE_RULE_ENT 0
|
||||
#define key_memory_rpl_filter 0
|
||||
|
||||
Rpl_filter *binlog_filter= 0;
|
||||
|
||||
#define BIN_LOG_HEADER_SIZE 4
|
||||
|
@ -196,7 +199,7 @@ Log_event* read_remote_annotate_event(uchar* net_buf, ulong event_len,
|
|||
uchar *event_buf;
|
||||
Log_event* event;
|
||||
|
||||
if (!(event_buf= (uchar*) my_malloc(event_len + 1, MYF(MY_WME))))
|
||||
if (!(event_buf= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED, event_len + 1, MYF(MY_WME))))
|
||||
{
|
||||
error("Out of memory");
|
||||
return 0;
|
||||
|
@ -308,7 +311,7 @@ public:
|
|||
|
||||
int init()
|
||||
{
|
||||
return my_init_dynamic_array(&file_names, sizeof(File_name_record),
|
||||
return my_init_dynamic_array(&file_names, PSI_NOT_INSTRUMENTED, sizeof(File_name_record),
|
||||
100, 100, MYF(0));
|
||||
}
|
||||
|
||||
|
@ -543,7 +546,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
|
|||
File_name_record rec;
|
||||
DBUG_ENTER("Load_log_processor::process_first_event");
|
||||
|
||||
if (!(fname= (char*) my_malloc(full_len,MYF(MY_WME))))
|
||||
if (!(fname= (char*) my_malloc(PSI_NOT_INSTRUMENTED, full_len,MYF(MY_WME))))
|
||||
{
|
||||
error("Out of memory.");
|
||||
delete ce;
|
||||
|
@ -1958,7 +1961,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
|
|||
{
|
||||
my_free(pass);
|
||||
char *start=argument;
|
||||
pass= my_strdup(argument,MYF(MY_FAE));
|
||||
pass= my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
if (*start)
|
||||
start[1]=0; /* Cut length of argument */
|
||||
|
@ -3044,9 +3047,9 @@ int main(int argc, char** argv)
|
|||
|
||||
if (opt_flashback)
|
||||
{
|
||||
my_init_dynamic_array(&binlog_events, sizeof(LEX_STRING), 1024, 1024,
|
||||
my_init_dynamic_array(&binlog_events, PSI_NOT_INSTRUMENTED, sizeof(LEX_STRING), 1024, 1024,
|
||||
MYF(0));
|
||||
my_init_dynamic_array(&events_in_stmt, sizeof(Rows_log_event*), 1024, 1024,
|
||||
my_init_dynamic_array(&events_in_stmt, PSI_NOT_INSTRUMENTED, sizeof(Rows_log_event*), 1024, 1024,
|
||||
MYF(0));
|
||||
}
|
||||
if (opt_stop_never)
|
||||
|
@ -3095,7 +3098,7 @@ int main(int argc, char** argv)
|
|||
retval= ERROR_STOP;
|
||||
goto err;
|
||||
}
|
||||
dirname_for_local_load= my_strdup(my_tmpdir(&tmpdir), MY_WME);
|
||||
dirname_for_local_load= my_strdup(PSI_NOT_INSTRUMENTED, my_tmpdir(&tmpdir), MY_WME);
|
||||
}
|
||||
|
||||
if (load_processor.init())
|
||||
|
|
|
@ -326,7 +326,7 @@ get_one_option(const struct my_option *opt,
|
|||
{
|
||||
char *start = argument;
|
||||
my_free(opt_password);
|
||||
opt_password = my_strdup(argument, MYF(MY_FAE));
|
||||
opt_password = my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
if (*start)
|
||||
start[1] = 0; /* Cut length of argument */
|
||||
|
@ -567,7 +567,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
|
|||
tot_length+= fixed_name_length(*(table_names + i)) + 2;
|
||||
|
||||
if (!(table_names_comma_sep = (char *)
|
||||
my_malloc((sizeof(char) * tot_length) + 4, MYF(MY_WME))))
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, tot_length + 4, MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
for (end = table_names_comma_sep + 1; tables > 0;
|
||||
|
@ -678,12 +678,12 @@ static int process_all_tables_in_db(char *database)
|
|||
}
|
||||
mysql_data_seek(res, 0);
|
||||
|
||||
if (!(tables=(char *) my_malloc(sizeof(char)*tot_length+4, MYF(MY_WME))))
|
||||
if (!(tables=(char *) my_malloc(PSI_NOT_INSTRUMENTED, tot_length+4, MYF(MY_WME))))
|
||||
{
|
||||
mysql_free_result(res);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (!(views=(char *) my_malloc(sizeof(char)*tot_views_length+4, MYF(MY_WME))))
|
||||
if (!(views=(char *) my_malloc(PSI_NOT_INSTRUMENTED, tot_views_length+4, MYF(MY_WME))))
|
||||
{
|
||||
my_free(tables);
|
||||
mysql_free_result(res);
|
||||
|
@ -799,8 +799,7 @@ static int rebuild_table(char *name)
|
|||
int rc= 0;
|
||||
DBUG_ENTER("rebuild_table");
|
||||
|
||||
query= (char*)my_malloc(sizeof(char) * (12 + strlen(name) + 6 + 1),
|
||||
MYF(MY_WME));
|
||||
query= (char*)my_malloc(PSI_NOT_INSTRUMENTED, 12+strlen(name)+6+1, MYF(MY_WME));
|
||||
if (!query)
|
||||
DBUG_RETURN(1);
|
||||
ptr= strxmov(query, "ALTER TABLE ", name, " FORCE", NullS);
|
||||
|
@ -938,7 +937,7 @@ static int handle_request_for_tables(char *tables, size_t length,
|
|||
DBUG_RETURN(fix_table_storage_name(tables));
|
||||
}
|
||||
|
||||
if (!(query =(char *) my_malloc(query_size, MYF(MY_WME))))
|
||||
if (!(query =(char *) my_malloc(PSI_NOT_INSTRUMENTED, query_size, MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
if (dont_quote)
|
||||
{
|
||||
|
@ -1195,14 +1194,14 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (opt_auto_repair &&
|
||||
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,
|
||||
64, MYF(0)) ||
|
||||
my_init_dynamic_array(&views4repair, sizeof(char)*(NAME_LEN*2+2),16,
|
||||
64, MYF(0)) ||
|
||||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,
|
||||
64, MYF(0)) ||
|
||||
my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0, 1,
|
||||
MYF(0))))
|
||||
(my_init_dynamic_array(&tables4repair, PSI_NOT_INSTRUMENTED,
|
||||
NAME_LEN*2+2, 16, 64, MYF(0)) ||
|
||||
my_init_dynamic_array(&views4repair, PSI_NOT_INSTRUMENTED,
|
||||
NAME_LEN*2+2, 16, 64, MYF(0)) ||
|
||||
my_init_dynamic_array(&tables4rebuild, PSI_NOT_INSTRUMENTED,
|
||||
NAME_LEN*2+2, 16, 64, MYF(0)) ||
|
||||
my_init_dynamic_array(&alter_table_cmds, PSI_NOT_INSTRUMENTED,
|
||||
MAX_ALTER_STR_SIZE, 0, 1, MYF(0))))
|
||||
goto end;
|
||||
|
||||
if (opt_alldbs)
|
||||
|
|
|
@ -826,7 +826,7 @@ get_one_option(const struct my_option *opt,
|
|||
{
|
||||
char *start=argument;
|
||||
my_free(opt_password);
|
||||
opt_password=my_strdup(argument,MYF(MY_FAE));
|
||||
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
if (*start)
|
||||
start[1]=0; /* Cut length of argument */
|
||||
|
@ -908,7 +908,8 @@ get_one_option(const struct my_option *opt,
|
|||
opt_databases=0;
|
||||
break;
|
||||
case (int) OPT_IGNORE_DATABASE:
|
||||
if (my_hash_insert(&ignore_database, (uchar*) my_strdup(argument, MYF(0))))
|
||||
if (my_hash_insert(&ignore_database,
|
||||
(uchar*) my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(0))))
|
||||
exit(EX_EOM);
|
||||
break;
|
||||
case (int) OPT_IGNORE_TABLE:
|
||||
|
@ -918,7 +919,8 @@ get_one_option(const struct my_option *opt,
|
|||
fprintf(stderr, "Illegal use of option --ignore-table=<database>.<table>\n");
|
||||
exit(1);
|
||||
}
|
||||
if (my_hash_insert(&ignore_table, (uchar*)my_strdup(argument, MYF(0))))
|
||||
if (my_hash_insert(&ignore_table,
|
||||
(uchar*)my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(0))))
|
||||
exit(EX_EOM);
|
||||
break;
|
||||
}
|
||||
|
@ -1000,22 +1002,22 @@ static int get_options(int *argc, char ***argv)
|
|||
defaults_argv= *argv;
|
||||
|
||||
if (my_hash_init(&ignore_database, charset_info, 16, 0, 0,
|
||||
(my_hash_get_key) get_table_key, my_free, 0))
|
||||
(my_hash_get_key) get_table_key, my_free, 0, PSI_NOT_INSTRUMENTED))
|
||||
return(EX_EOM);
|
||||
if (my_hash_init(&ignore_table, charset_info, 16, 0, 0,
|
||||
(my_hash_get_key) get_table_key, my_free, 0))
|
||||
(my_hash_get_key) get_table_key, my_free, 0, PSI_NOT_INSTRUMENTED))
|
||||
return(EX_EOM);
|
||||
/* Don't copy internal log tables */
|
||||
if (my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.schema", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.transaction_registry", MYF(MY_WME))))
|
||||
if (my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
"mysql.apply_status", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
"mysql.schema", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
"mysql.general_log", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
"mysql.slow_log", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
"mysql.transaction_registry", MYF(MY_WME))))
|
||||
return(EX_EOM);
|
||||
|
||||
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
|
@ -1793,7 +1795,7 @@ static void unescape(FILE *file,char *pos, size_t length)
|
|||
{
|
||||
char *tmp;
|
||||
DBUG_ENTER("unescape");
|
||||
if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME))))
|
||||
if (!(tmp=(char*) my_malloc(PSI_NOT_INSTRUMENTED, length*2+1, MYF(MY_WME))))
|
||||
die(EX_MYSQLERR, "Couldn't allocate memory");
|
||||
|
||||
mysql_real_escape_string(&mysql_connection, tmp, pos, (ulong)length);
|
||||
|
@ -2876,7 +2878,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
|||
|
||||
/* save "show create" statement for later */
|
||||
if ((row= mysql_fetch_row(result)) && (scv_buff=row[1]))
|
||||
scv_buff= my_strdup(scv_buff, MYF(0));
|
||||
scv_buff= my_strdup(PSI_NOT_INSTRUMENTED, scv_buff, MYF(0));
|
||||
|
||||
mysql_free_result(result);
|
||||
|
||||
|
@ -3677,7 +3679,7 @@ static char *alloc_query_str(size_t size)
|
|||
{
|
||||
char *query;
|
||||
|
||||
if (!(query= (char*) my_malloc(size, MYF(MY_WME))))
|
||||
if (!(query= (char*) my_malloc(PSI_NOT_INSTRUMENTED, size, MYF(MY_WME))))
|
||||
die(EX_MYSQLERR, "Couldn't allocate a query string.");
|
||||
|
||||
return query;
|
||||
|
@ -5067,7 +5069,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||
if (init_dumping(db, init_dumping_tables))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
init_alloc_root(&glob_root, "glob_root", 8192, 0, MYF(0));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &glob_root, 8192, 0, MYF(0));
|
||||
if (!(dump_tables= pos= (char**) alloc_root(&glob_root,
|
||||
tables * sizeof(char *))))
|
||||
die(EX_EOM, "alloc_root failure.");
|
||||
|
@ -5819,7 +5821,7 @@ static char *primary_key_fields(const char *table_name)
|
|||
{
|
||||
char *end;
|
||||
/* result (terminating \0 is already in result_length) */
|
||||
result= my_malloc(result_length + 10, MYF(MY_WME));
|
||||
result= my_malloc(PSI_NOT_INSTRUMENTED, result_length + 10, MYF(MY_WME));
|
||||
if (!result)
|
||||
{
|
||||
fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n");
|
||||
|
|
|
@ -232,7 +232,7 @@ get_one_option(const struct my_option *opt, char *argument,
|
|||
{
|
||||
char *start=argument;
|
||||
my_free(opt_password);
|
||||
opt_password=my_strdup(argument,MYF(MY_FAE));
|
||||
opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
if (*start)
|
||||
start[1]=0; /* Cut length of argument */
|
||||
|
@ -672,9 +672,8 @@ int main(int argc, char **argv)
|
|||
table_count++;
|
||||
argv= save_argv;
|
||||
|
||||
if (!(worker_threads= (pthread_t*) my_malloc(table_count *
|
||||
sizeof(*worker_threads),
|
||||
MYF(0))))
|
||||
if (!(worker_threads= (pthread_t*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
table_count * sizeof(*worker_threads), MYF(0))))
|
||||
return -2;
|
||||
|
||||
for (; *argv != NULL; argv++) /* Loop through tables */
|
||||
|
|
|
@ -303,7 +303,7 @@ get_one_option(const struct my_option *opt, char *argument,
|
|||
{
|
||||
char *start=argument;
|
||||
my_free(opt_password);
|
||||
opt_password=my_strdup(argument,MYF(MY_FAE));
|
||||
opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
if (*start)
|
||||
start[1]=0; /* Cut length of argument */
|
||||
|
|
|
@ -433,8 +433,8 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
|
|||
unsigned long long client_limit;
|
||||
int sysret;
|
||||
|
||||
head_sptr= (stats *)my_malloc(sizeof(stats) * iterations,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
head_sptr= (stats *)my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(stats) * iterations, MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
|
||||
bzero(&conclusion, sizeof(conclusions));
|
||||
|
||||
|
@ -741,7 +741,7 @@ get_one_option(const struct my_option *opt, char *argument,
|
|||
{
|
||||
char *start= argument;
|
||||
my_free(opt_password);
|
||||
opt_password= my_strdup(argument,MYF(MY_FAE));
|
||||
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
if (*start)
|
||||
start[1]= 0; /* Cut length of argument */
|
||||
|
@ -918,9 +918,9 @@ build_table_string(void)
|
|||
}
|
||||
|
||||
dynstr_append(&table_string, ")");
|
||||
ptr= (statement *)my_malloc(sizeof(statement),
|
||||
ptr= (statement *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(statement),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
ptr->string = (char *)my_malloc(table_string.length+1,
|
||||
ptr->string = (char *)my_malloc(PSI_NOT_INSTRUMENTED, table_string.length+1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
ptr->length= table_string.length+1;
|
||||
ptr->type= CREATE_TABLE_TYPE;
|
||||
|
@ -986,10 +986,10 @@ build_update_string(void)
|
|||
dynstr_append(&update_string, " WHERE id = ");
|
||||
|
||||
|
||||
ptr= (statement *)my_malloc(sizeof(statement),
|
||||
ptr= (statement *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(statement),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
|
||||
ptr->string= (char *)my_malloc(update_string.length + 1,
|
||||
ptr->string= (char *)my_malloc(PSI_NOT_INSTRUMENTED, update_string.length + 1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
ptr->length= update_string.length+1;
|
||||
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
|
||||
|
@ -1082,9 +1082,9 @@ build_insert_string(void)
|
|||
|
||||
dynstr_append_mem(&insert_string, ")", 1);
|
||||
|
||||
ptr= (statement *)my_malloc(sizeof(statement),
|
||||
ptr= (statement *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(statement),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
ptr->string= (char *)my_malloc(insert_string.length + 1,
|
||||
ptr->string= (char *)my_malloc(PSI_NOT_INSTRUMENTED, insert_string.length + 1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
ptr->length= insert_string.length+1;
|
||||
ptr->type= INSERT_TYPE;
|
||||
|
@ -1146,9 +1146,9 @@ build_select_string(my_bool key)
|
|||
(auto_generate_sql_autoincrement || auto_generate_sql_guid_primary))
|
||||
dynstr_append(&query_string, " WHERE id = ");
|
||||
|
||||
ptr= (statement *)my_malloc(sizeof(statement),
|
||||
ptr= (statement *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(statement),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
ptr->string= (char *)my_malloc(query_string.length + 1,
|
||||
ptr->string= (char *)my_malloc(PSI_NOT_INSTRUMENTED, query_string.length + 1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
ptr->length= query_string.length+1;
|
||||
if ((key) &&
|
||||
|
@ -1405,7 +1405,7 @@ get_options(int *argc,char ***argv)
|
|||
fprintf(stderr,"%s: Could not open create file\n", my_progname);
|
||||
exit(1);
|
||||
}
|
||||
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
|
||||
tmp_string= (char *)my_malloc(PSI_NOT_INSTRUMENTED, (size_t)sbuf.st_size + 1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
|
||||
tmp_string[sbuf.st_size]= '\0';
|
||||
|
@ -1432,7 +1432,7 @@ get_options(int *argc,char ***argv)
|
|||
fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
|
||||
exit(1);
|
||||
}
|
||||
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
|
||||
tmp_string= (char *)my_malloc(PSI_NOT_INSTRUMENTED, (size_t)sbuf.st_size + 1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
|
||||
tmp_string[sbuf.st_size]= '\0';
|
||||
|
@ -1463,7 +1463,7 @@ get_options(int *argc,char ***argv)
|
|||
fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
|
||||
exit(1);
|
||||
}
|
||||
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
|
||||
tmp_string= (char *)my_malloc(PSI_NOT_INSTRUMENTED, (size_t)sbuf.st_size + 1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
|
||||
tmp_string[sbuf.st_size]= '\0';
|
||||
|
@ -1494,7 +1494,7 @@ get_options(int *argc,char ***argv)
|
|||
fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
|
||||
exit(1);
|
||||
}
|
||||
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
|
||||
tmp_string= (char *)my_malloc(PSI_NOT_INSTRUMENTED, (size_t)sbuf.st_size + 1,
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
|
||||
tmp_string[sbuf.st_size]= '\0';
|
||||
|
@ -1560,11 +1560,11 @@ generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt)
|
|||
strstr(engine_stmt->string, "blackhole")))
|
||||
{
|
||||
primary_keys_number_of= 1;
|
||||
primary_keys= (char **)my_malloc((uint)(sizeof(char *) *
|
||||
primary_keys_number_of),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
primary_keys= (char **)my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
(size_t)(sizeof(char *) * primary_keys_number_of),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
/* Yes, we strdup a const string to simplify the interface */
|
||||
primary_keys[0]= my_strdup("796c4422-1d94-102a-9d6d-00e0812d", MYF(0));
|
||||
primary_keys[0]= my_strdup(PSI_NOT_INSTRUMENTED, "796c4422-1d94-102a-9d6d-00e0812d", MYF(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1589,13 +1589,13 @@ generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt)
|
|||
/*
|
||||
We create the structure and loop and create the items.
|
||||
*/
|
||||
primary_keys= (char **)my_malloc((uint)(sizeof(char *) *
|
||||
primary_keys_number_of),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
primary_keys= (char **)my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
(size_t)(sizeof(char *) * primary_keys_number_of),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
row= mysql_fetch_row(result);
|
||||
for (counter= 0; counter < primary_keys_number_of;
|
||||
counter++, row= mysql_fetch_row(result))
|
||||
primary_keys[counter]= my_strdup(row[0], MYF(0));
|
||||
primary_keys[counter]= my_strdup(PSI_NOT_INSTRUMENTED, row[0], MYF(0));
|
||||
}
|
||||
|
||||
mysql_free_result(result);
|
||||
|
@ -2006,10 +2006,10 @@ parse_option(const char *origin, option_string **stmt, char delm)
|
|||
size_t length= strlen(origin);
|
||||
uint count= 0; /* We know that there is always one */
|
||||
|
||||
for (tmp= *sptr= (option_string *)my_malloc(sizeof(option_string),
|
||||
for (tmp= *sptr= (option_string *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(option_string),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
(retstr= strchr(ptr, delm));
|
||||
tmp->next= (option_string *)my_malloc(sizeof(option_string),
|
||||
tmp->next= (option_string *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(option_string),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME)),
|
||||
tmp= tmp->next)
|
||||
{
|
||||
|
@ -2040,18 +2040,18 @@ parse_option(const char *origin, option_string **stmt, char delm)
|
|||
char *option_ptr;
|
||||
|
||||
tmp->length= (size_t)(buffer_ptr - buffer);
|
||||
tmp->string= my_strndup(ptr, (uint)tmp->length, MYF(MY_FAE));
|
||||
tmp->string= my_strndup(PSI_NOT_INSTRUMENTED, ptr, (uint)tmp->length, MYF(MY_FAE));
|
||||
|
||||
option_ptr= ptr + 1 + tmp->length;
|
||||
|
||||
/* Move past the : and the first string */
|
||||
tmp->option_length= (size_t)(retstr - option_ptr);
|
||||
tmp->option= my_strndup(option_ptr, (uint)tmp->option_length,
|
||||
tmp->option= my_strndup(PSI_NOT_INSTRUMENTED, option_ptr, (uint)tmp->option_length,
|
||||
MYF(MY_FAE));
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp->string= my_strndup(ptr, (size_t)(retstr - ptr), MYF(MY_FAE));
|
||||
tmp->string= my_strndup(PSI_NOT_INSTRUMENTED, ptr, (size_t)(retstr - ptr), MYF(MY_FAE));
|
||||
tmp->length= (size_t)(retstr - ptr);
|
||||
}
|
||||
|
||||
|
@ -2079,19 +2079,19 @@ parse_option(const char *origin, option_string **stmt, char delm)
|
|||
char *option_ptr;
|
||||
|
||||
tmp->length= (size_t)(origin_ptr - ptr);
|
||||
tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE));
|
||||
tmp->string= my_strndup(PSI_NOT_INSTRUMENTED, ptr, tmp->length, MYF(MY_FAE));
|
||||
|
||||
option_ptr= (char *)ptr + 1 + tmp->length;
|
||||
|
||||
/* Move past the : and the first string */
|
||||
tmp->option_length= strlen(option_ptr);
|
||||
tmp->option= my_strndup(option_ptr, tmp->option_length,
|
||||
tmp->option= my_strndup(PSI_NOT_INSTRUMENTED, option_ptr, tmp->option_length,
|
||||
MYF(MY_FAE));
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp->length= strlen(ptr);
|
||||
tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE));
|
||||
tmp->string= my_strndup(PSI_NOT_INSTRUMENTED, ptr, tmp->length, MYF(MY_FAE));
|
||||
}
|
||||
|
||||
count++;
|
||||
|
@ -2111,15 +2111,15 @@ parse_delimiter(const char *script, statement **stmt, char delm)
|
|||
size_t length= strlen(script);
|
||||
uint count= 0; /* We know that there is always one */
|
||||
|
||||
for (tmp= *sptr= (statement *)my_malloc(sizeof(statement),
|
||||
for (tmp= *sptr= (statement *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(statement),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
(retstr= strchr(ptr, delm));
|
||||
tmp->next= (statement *)my_malloc(sizeof(statement),
|
||||
tmp->next= (statement *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(statement),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME)),
|
||||
tmp= tmp->next)
|
||||
{
|
||||
count++;
|
||||
tmp->string= my_strndup(ptr, (uint)(retstr - ptr), MYF(MY_FAE));
|
||||
tmp->string= my_strndup(PSI_NOT_INSTRUMENTED, ptr, (uint)(retstr - ptr), MYF(MY_FAE));
|
||||
tmp->length= (size_t)(retstr - ptr);
|
||||
ptr+= retstr - ptr + 1;
|
||||
if (isspace(*ptr))
|
||||
|
@ -2128,7 +2128,7 @@ parse_delimiter(const char *script, statement **stmt, char delm)
|
|||
|
||||
if (ptr != script+length)
|
||||
{
|
||||
tmp->string= my_strndup(ptr, (uint)((script + length) - ptr),
|
||||
tmp->string= my_strndup(PSI_NOT_INSTRUMENTED, ptr, (uint)((script + length) - ptr),
|
||||
MYF(MY_FAE));
|
||||
tmp->length= (size_t)((script + length) - ptr);
|
||||
count++;
|
||||
|
@ -2150,7 +2150,7 @@ parse_comma(const char *string, uint **range)
|
|||
if (*ptr == ',') count++;
|
||||
|
||||
/* One extra spot for the NULL */
|
||||
nptr= *range= (uint *)my_malloc(sizeof(uint) * (count + 1),
|
||||
nptr= *range= (uint *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(uint) * (count + 1),
|
||||
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
|
||||
|
||||
ptr= (char *)string;
|
||||
|
|
|
@ -1770,7 +1770,7 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
|
|||
len= (size_t) my_seek(fd, 0, SEEK_END, MYF(0));
|
||||
my_seek(fd, 0, SEEK_SET, MYF(0));
|
||||
if (len == (size_t)MY_FILEPOS_ERROR ||
|
||||
!(buff= (char*)my_malloc(len + 1, MYF(0))))
|
||||
!(buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, len + 1, MYF(0))))
|
||||
{
|
||||
my_close(fd, MYF(0));
|
||||
return 1;
|
||||
|
@ -2428,7 +2428,7 @@ VAR *var_init(VAR *v, const char *name, size_t name_len, const char *val, size_t
|
|||
if (!val)
|
||||
val_len= 0;
|
||||
val_alloc_len = val_len + 16; /* room to grow */
|
||||
if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(sizeof(*tmp_var)
|
||||
if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*tmp_var)
|
||||
+ name_len+2, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
|
@ -2443,7 +2443,7 @@ VAR *var_init(VAR *v, const char *name, size_t name_len, const char *val, size_t
|
|||
|
||||
tmp_var->alloced = (v == 0);
|
||||
|
||||
if (!(tmp_var->str_val = (char*)my_malloc(val_alloc_len+1, MYF(MY_WME))))
|
||||
if (!(tmp_var->str_val = (char*)my_malloc(PSI_NOT_INSTRUMENTED, val_alloc_len+1, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
if (val)
|
||||
|
@ -2991,8 +2991,8 @@ void var_copy(VAR *dest, VAR *src)
|
|||
/* Alloc/realloc data for str_val in dest */
|
||||
if (dest->alloced_len < src->alloced_len &&
|
||||
!(dest->str_val= dest->str_val
|
||||
? (char*)my_realloc(dest->str_val, src->alloced_len, MYF(MY_WME))
|
||||
: (char*)my_malloc(src->alloced_len, MYF(MY_WME))))
|
||||
? (char*)my_realloc(PSI_NOT_INSTRUMENTED, dest->str_val, src->alloced_len, MYF(MY_WME))
|
||||
: (char*)my_malloc(PSI_NOT_INSTRUMENTED, src->alloced_len, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
else
|
||||
dest->alloced_len= src->alloced_len;
|
||||
|
@ -3069,8 +3069,8 @@ void eval_expr(VAR *v, const char *p, const char **p_end,
|
|||
MIN_VAR_ALLOC : new_val_len + 1;
|
||||
if (!(v->str_val =
|
||||
v->str_val ?
|
||||
(char*)my_realloc(v->str_val, v->alloced_len+1, MYF(MY_WME)) :
|
||||
(char*)my_malloc(v->alloced_len+1, MYF(MY_WME))))
|
||||
(char*)my_realloc(PSI_NOT_INSTRUMENTED, v->str_val, v->alloced_len+1, MYF(MY_WME)) :
|
||||
(char*)my_malloc(PSI_NOT_INSTRUMENTED, v->alloced_len+1, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
}
|
||||
v->str_val_len = new_val_len;
|
||||
|
@ -3091,7 +3091,7 @@ bool open_and_set_current(const char *name)
|
|||
|
||||
cur_file++;
|
||||
cur_file->file= opened;
|
||||
cur_file->file_name= my_strdup(name, MYF(MY_FAE));
|
||||
cur_file->file_name= my_strdup(PSI_NOT_INSTRUMENTED, name, MYF(MY_FAE));
|
||||
cur_file->lineno=1;
|
||||
return true;
|
||||
}
|
||||
|
@ -4846,7 +4846,7 @@ void do_sync_with_master(struct st_command *command)
|
|||
p++;
|
||||
while (*p && my_isspace(charset_info, *p))
|
||||
p++;
|
||||
start= buff= (char*)my_malloc(strlen(p)+1,MYF(MY_WME | MY_FAE));
|
||||
start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(p)+1,MYF(MY_WME | MY_FAE));
|
||||
get_string(&buff, &p, command);
|
||||
}
|
||||
command->last_argument= p;
|
||||
|
@ -5651,7 +5651,7 @@ void do_close_connection(struct st_command *command)
|
|||
When the connection is closed set name to "-closed_connection-"
|
||||
to make it possible to reuse the connection name.
|
||||
*/
|
||||
if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
|
||||
if (!(con->name = my_strdup(PSI_NOT_INSTRUMENTED, "-closed_connection-", MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
if (con == cur_con)
|
||||
|
@ -6122,7 +6122,7 @@ void do_connect(struct st_command *command)
|
|||
{
|
||||
DBUG_PRINT("info", ("Inserting connection %s in connection pool",
|
||||
ds_connection_name.str));
|
||||
if (!(con_slot->name= my_strdup(ds_connection_name.str, MYF(MY_WME))))
|
||||
if (!(con_slot->name= my_strdup(PSI_NOT_INSTRUMENTED, ds_connection_name.str, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
con_slot->name_len= strlen(con_slot->name);
|
||||
set_current_connection(con_slot);
|
||||
|
@ -6573,7 +6573,7 @@ int read_line()
|
|||
if (p >= buf_end)
|
||||
{
|
||||
my_ptrdiff_t off= p - read_command_buf;
|
||||
read_command_buf= (char*)my_realloc(read_command_buf,
|
||||
read_command_buf= (char*)my_realloc(PSI_NOT_INSTRUMENTED, read_command_buf,
|
||||
read_command_buflen*2, MYF(MY_FAE));
|
||||
p= read_command_buf + off;
|
||||
read_command_buflen*= 2;
|
||||
|
@ -6920,7 +6920,7 @@ int read_command(struct st_command** command_ptr)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
if (!(*command_ptr= command=
|
||||
(struct st_command*) my_malloc(sizeof(*command),
|
||||
(struct st_command*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*command),
|
||||
MYF(MY_WME|MY_ZEROFILL))) ||
|
||||
insert_dynamic(&q_lines, &command))
|
||||
die("Out of memory");
|
||||
|
@ -6955,7 +6955,7 @@ int read_command(struct st_command** command_ptr)
|
|||
while (*p && my_isspace(charset_info, *p))
|
||||
p++;
|
||||
|
||||
if (!(command->query_buf= command->query= my_strdup(p, MYF(MY_WME))))
|
||||
if (!(command->query_buf= command->query= my_strdup(PSI_NOT_INSTRUMENTED, p, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
/*
|
||||
|
@ -7168,7 +7168,7 @@ void read_embedded_server_arguments(const char *name)
|
|||
{
|
||||
*(strend(str)-1)=0; /* Remove end newline */
|
||||
if (!(embedded_server_args[embedded_server_arg_count]=
|
||||
my_strdup(str, MYF(MY_WME))))
|
||||
my_strdup(PSI_NOT_INSTRUMENTED, str, MYF(MY_WME))))
|
||||
{
|
||||
my_fclose(file,MYF(0));
|
||||
die("Out of memory");
|
||||
|
@ -7211,7 +7211,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
|
|||
if (!(cur_file->file=
|
||||
fopen(buff, "rb")))
|
||||
die("Could not open '%s' for reading, errno: %d", buff, errno);
|
||||
cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
|
||||
cur_file->file_name= my_strdup(PSI_NOT_INSTRUMENTED, buff, MYF(MY_FAE));
|
||||
cur_file->lineno= 1;
|
||||
break;
|
||||
}
|
||||
|
@ -7234,7 +7234,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
|
|||
if (argument)
|
||||
{
|
||||
my_free(opt_pass);
|
||||
opt_pass= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_pass= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
tty_password= 0;
|
||||
}
|
||||
|
@ -7253,7 +7253,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
|
|||
}
|
||||
if (embedded_server_arg_count == MAX_EMBEDDED_SERVER_ARGS-1 ||
|
||||
!(embedded_server_args[embedded_server_arg_count++]=
|
||||
my_strdup(argument, MYF(MY_FAE))))
|
||||
my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE))))
|
||||
{
|
||||
die("Can't use server argument");
|
||||
}
|
||||
|
@ -7427,7 +7427,7 @@ void init_win_path_patterns()
|
|||
|
||||
DBUG_ENTER("init_win_path_patterns");
|
||||
|
||||
my_init_dynamic_array(&patterns, sizeof(const char*), 16, 16, MYF(0));
|
||||
my_init_dynamic_array(&patterns, PSI_NOT_INSTRUMENTED, sizeof(const char*), 16, 16, MYF(0));
|
||||
|
||||
/* Loop through all paths in the array */
|
||||
for (i= 0; i < num_paths; i++)
|
||||
|
@ -7436,10 +7436,10 @@ void init_win_path_patterns()
|
|||
if (*(paths[i]) == '$')
|
||||
{
|
||||
v= var_get(paths[i], 0, 0, 0);
|
||||
p= my_strdup(v->str_val, MYF(MY_FAE));
|
||||
p= my_strdup(PSI_NOT_INSTRUMENTED, v->str_val, MYF(MY_FAE));
|
||||
}
|
||||
else
|
||||
p= my_strdup(paths[i], MYF(MY_FAE));
|
||||
p= my_strdup(PSI_NOT_INSTRUMENTED, paths[i], MYF(MY_FAE));
|
||||
|
||||
/* Don't insert zero length strings in patterns array */
|
||||
if (strlen(p) == 0)
|
||||
|
@ -7623,11 +7623,11 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
|||
int error;
|
||||
|
||||
/* Allocate array with bind structs, lengths and NULL flags */
|
||||
my_bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
|
||||
my_bind= (MYSQL_BIND*) my_malloc(PSI_NOT_INSTRUMENTED, num_fields * sizeof(MYSQL_BIND),
|
||||
MYF(MY_WME | MY_FAE | MY_ZEROFILL));
|
||||
length= (ulong*) my_malloc(num_fields * sizeof(ulong),
|
||||
length= (ulong*) my_malloc(PSI_NOT_INSTRUMENTED, num_fields * sizeof(ulong),
|
||||
MYF(MY_WME | MY_FAE));
|
||||
is_null= (my_bool*) my_malloc(num_fields * sizeof(my_bool),
|
||||
is_null= (my_bool*) my_malloc(PSI_NOT_INSTRUMENTED, num_fields * sizeof(my_bool),
|
||||
MYF(MY_WME | MY_FAE));
|
||||
|
||||
/* Allocate data for the result of each field */
|
||||
|
@ -7635,7 +7635,7 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
|||
{
|
||||
uint max_length= fields[i].max_length + 1;
|
||||
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
my_bind[i].buffer= my_malloc(max_length, MYF(MY_WME | MY_FAE));
|
||||
my_bind[i].buffer= my_malloc(PSI_NOT_INSTRUMENTED, max_length, MYF(MY_WME | MY_FAE));
|
||||
my_bind[i].buffer_length= max_length;
|
||||
my_bind[i].is_null= &is_null[i];
|
||||
my_bind[i].length= &length[i];
|
||||
|
@ -9185,10 +9185,10 @@ int main(int argc, char **argv)
|
|||
cur_block->ok= TRUE; /* Outer block should always be executed */
|
||||
cur_block->cmd= cmd_none;
|
||||
|
||||
my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024, MYF(0));
|
||||
my_init_dynamic_array(&q_lines, PSI_NOT_INSTRUMENTED, sizeof(struct st_command*), 1024, 1024, MYF(0));
|
||||
|
||||
if (my_hash_init2(&var_hash, 64, charset_info,
|
||||
128, 0, 0, get_var_key, 0, var_free, MYF(0)))
|
||||
128, 0, 0, get_var_key, 0, var_free, MYF(0), PSI_NOT_INSTRUMENTED))
|
||||
die("Variable hash initialization failed");
|
||||
|
||||
{
|
||||
|
@ -9218,10 +9218,10 @@ int main(int argc, char **argv)
|
|||
init_win_path_patterns();
|
||||
#endif
|
||||
|
||||
read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
|
||||
read_command_buf= (char*)my_malloc(PSI_NOT_INSTRUMENTED, read_command_buflen= 65536, MYF(MY_FAE));
|
||||
|
||||
init_dynamic_string(&ds_res, "", 2048, 2048);
|
||||
init_alloc_root(&require_file_root, "require_file", 1024, 1024, MYF(0));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &require_file_root, 1024, 1024, MYF(0));
|
||||
|
||||
parse_args(argc, argv);
|
||||
|
||||
|
@ -9235,7 +9235,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Init connections, allocate 1 extra as buffer + 1 for default */
|
||||
connections= (struct st_connection*)
|
||||
my_malloc((opt_max_connections+2) * sizeof(struct st_connection),
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, (opt_max_connections+2) * sizeof(struct st_connection),
|
||||
MYF(MY_WME | MY_ZEROFILL));
|
||||
connections_end= connections + opt_max_connections +1;
|
||||
next_con= connections + 1;
|
||||
|
@ -9266,7 +9266,7 @@ int main(int argc, char **argv)
|
|||
if (cur_file == file_stack && cur_file->file == 0)
|
||||
{
|
||||
cur_file->file= stdin;
|
||||
cur_file->file_name= my_strdup("<stdin>", MYF(MY_WME));
|
||||
cur_file->file_name= my_strdup(PSI_NOT_INSTRUMENTED, "<stdin>", MYF(MY_WME));
|
||||
cur_file->lineno= 1;
|
||||
}
|
||||
var_set_string("MYSQLTEST_FILE", cur_file->file_name);
|
||||
|
@ -9319,7 +9319,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!(con->name = my_strdup("default", MYF(MY_WME))))
|
||||
if (!(con->name = my_strdup(PSI_NOT_INSTRUMENTED, "default", MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
mysql_options(con->mysql, MYSQL_OPT_NONBLOCK, 0);
|
||||
|
||||
|
@ -9915,7 +9915,7 @@ void do_get_replace_column(struct st_command *command)
|
|||
die("Missing argument in %s", command->query);
|
||||
|
||||
/* Allocate a buffer for results */
|
||||
start= buff= (char*)my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE));
|
||||
start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(from)+1,MYF(MY_WME | MY_FAE));
|
||||
while (*from)
|
||||
{
|
||||
char *to;
|
||||
|
@ -9928,7 +9928,7 @@ void do_get_replace_column(struct st_command *command)
|
|||
command->query);
|
||||
to= get_string(&buff, &from, command);
|
||||
my_free(replace_column[column_number-1]);
|
||||
replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE));
|
||||
replace_column[column_number-1]= my_strdup(PSI_NOT_INSTRUMENTED, to, MYF(MY_WME | MY_FAE));
|
||||
set_if_bigger(max_replace_column, column_number);
|
||||
}
|
||||
my_free(start);
|
||||
|
@ -9995,7 +9995,7 @@ void do_get_replace(struct st_command *command)
|
|||
bzero(&from_array,sizeof(from_array));
|
||||
if (!*from)
|
||||
die("Missing argument in %s", command->query);
|
||||
start= buff= (char*)my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE));
|
||||
start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(from)+1,MYF(MY_WME | MY_FAE));
|
||||
while (*from)
|
||||
{
|
||||
char *to= buff;
|
||||
|
@ -10157,17 +10157,17 @@ struct st_replace_regex* init_replace_regex(char* expr)
|
|||
size_t expr_len= strlen(expr);
|
||||
|
||||
/* my_malloc() will die on fail with MY_FAE */
|
||||
res=(struct st_replace_regex*)my_malloc(
|
||||
res=(struct st_replace_regex*)my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(*res)+8192 ,MYF(MY_FAE+MY_WME));
|
||||
my_init_dynamic_array(&res->regex_arr,sizeof(struct st_regex), 128, 128, MYF(0));
|
||||
my_init_dynamic_array(&res->regex_arr,PSI_NOT_INSTRUMENTED, sizeof(struct st_regex), 128, 128, MYF(0));
|
||||
|
||||
expr_end= expr + expr_len;
|
||||
buf_p= (char*)res + sizeof(*res);
|
||||
append_replace_regex(expr, expr_end, res, &buf_p);
|
||||
|
||||
res->odd_buf_len= res->even_buf_len= 8192;
|
||||
res->even_buf= (char*)my_malloc(res->even_buf_len,MYF(MY_WME+MY_FAE));
|
||||
res->odd_buf= (char*)my_malloc(res->odd_buf_len,MYF(MY_WME+MY_FAE));
|
||||
res->even_buf= (char*)my_malloc(PSI_NOT_INSTRUMENTED, res->even_buf_len,MYF(MY_WME+MY_FAE));
|
||||
res->odd_buf= (char*)my_malloc(PSI_NOT_INSTRUMENTED, res->odd_buf_len,MYF(MY_WME+MY_FAE));
|
||||
res->buf= res->even_buf;
|
||||
|
||||
return res;
|
||||
|
@ -10350,7 +10350,7 @@ void free_replace_regex()
|
|||
#define SECURE_REG_BUF if (buf_len < need_buf_len) \
|
||||
{ \
|
||||
ssize_t off= res_p - buf; \
|
||||
buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE)); \
|
||||
buf= (char*)my_realloc(PSI_NOT_INSTRUMENTED, buf,need_buf_len,MYF(MY_WME+MY_FAE)); \
|
||||
res_p= buf + off; \
|
||||
buf_len= need_buf_len; \
|
||||
} \
|
||||
|
@ -10403,7 +10403,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
|||
return 1;
|
||||
}
|
||||
|
||||
subs= (regmatch_t*)my_malloc(sizeof(regmatch_t) * (r.re_nsub+1),
|
||||
subs= (regmatch_t*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(regmatch_t) * (r.re_nsub+1),
|
||||
MYF(MY_WME+MY_FAE));
|
||||
|
||||
*res_p= 0;
|
||||
|
@ -10651,7 +10651,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
if (init_sets(&sets,states))
|
||||
DBUG_RETURN(0);
|
||||
found_sets=0;
|
||||
if (!(found_set= (FOUND_SET*) my_malloc(sizeof(FOUND_SET)*max_length*count,
|
||||
if (!(found_set= (FOUND_SET*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(FOUND_SET)*max_length*count,
|
||||
MYF(MY_WME))))
|
||||
{
|
||||
free_sets(&sets);
|
||||
|
@ -10662,7 +10662,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
used_sets=-1;
|
||||
word_states=make_new_set(&sets); /* Start of new word */
|
||||
start_states=make_new_set(&sets); /* This is first state */
|
||||
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
|
||||
if (!(follow=(FOLLOWS*) my_malloc(PSI_NOT_INSTRUMENTED, (states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
|
||||
{
|
||||
free_sets(&sets);
|
||||
my_free(found_set);
|
||||
|
@ -10826,7 +10826,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
|
||||
/* Alloc replace structure for the replace-state-machine */
|
||||
|
||||
if ((replace=(REPLACE*) my_malloc(sizeof(REPLACE)*(sets.count)+
|
||||
if ((replace=(REPLACE*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(REPLACE)*(sets.count)+
|
||||
sizeof(REPLACE_STRING)*(found_sets+1)+
|
||||
sizeof(char *)*count+result_len,
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
|
@ -10871,10 +10871,10 @@ int init_sets(REP_SETS *sets,uint states)
|
|||
{
|
||||
bzero(sets, sizeof(*sets));
|
||||
sets->size_of_bits=((states+7)/8);
|
||||
if (!(sets->set_buffer=(REP_SET*) my_malloc(sizeof(REP_SET)*SET_MALLOC_HUNC,
|
||||
if (!(sets->set_buffer=(REP_SET*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(REP_SET)*SET_MALLOC_HUNC,
|
||||
MYF(MY_WME))))
|
||||
return 1;
|
||||
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
|
||||
if (!(sets->bit_buffer=(uint*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(uint)*sets->size_of_bits*
|
||||
SET_MALLOC_HUNC,MYF(MY_WME))))
|
||||
{
|
||||
my_free(sets->set);
|
||||
|
@ -10909,12 +10909,12 @@ REP_SET *make_new_set(REP_SETS *sets)
|
|||
return set;
|
||||
}
|
||||
count=sets->count+sets->invisible+SET_MALLOC_HUNC;
|
||||
if (!(set=(REP_SET*) my_realloc(sets->set_buffer, sizeof(REP_SET)*count,
|
||||
if (!(set=(REP_SET*) my_realloc(PSI_NOT_INSTRUMENTED, sets->set_buffer, sizeof(REP_SET)*count,
|
||||
MYF(MY_WME))))
|
||||
return 0;
|
||||
sets->set_buffer=set;
|
||||
sets->set=set+sets->invisible;
|
||||
if (!(bit_buffer=(uint*) my_realloc(sets->bit_buffer,
|
||||
if (!(bit_buffer=(uint*) my_realloc(PSI_NOT_INSTRUMENTED, sets->bit_buffer,
|
||||
(sizeof(uint)*sets->size_of_bits)*count,
|
||||
MYF(MY_WME))))
|
||||
return 0;
|
||||
|
@ -11069,11 +11069,11 @@ int insert_pointer_name(POINTER_ARRAY *pa,char * name)
|
|||
if (! pa->typelib.count)
|
||||
{
|
||||
if (!(pa->typelib.type_names=(const char **)
|
||||
my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, ((PC_MALLOC-MALLOC_OVERHEAD)/
|
||||
(sizeof(char *)+sizeof(*pa->flag))*
|
||||
(sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME))))
|
||||
DBUG_RETURN(-1);
|
||||
if (!(pa->str= (uchar*) my_malloc(PS_MALLOC - MALLOC_OVERHEAD,
|
||||
if (!(pa->str= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED, PS_MALLOC - MALLOC_OVERHEAD,
|
||||
MYF(MY_WME))))
|
||||
{
|
||||
my_free(pa->typelib.type_names);
|
||||
|
@ -11089,7 +11089,7 @@ int insert_pointer_name(POINTER_ARRAY *pa,char * name)
|
|||
length=(uint) strlen(name)+1;
|
||||
if (pa->length+length >= pa->max_length)
|
||||
{
|
||||
if (!(new_pos= (uchar*) my_realloc(pa->str, pa->length + length + PS_MALLOC,
|
||||
if (!(new_pos= (uchar*) my_realloc(PSI_NOT_INSTRUMENTED, pa->str, pa->length + length + PS_MALLOC,
|
||||
MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
if (new_pos != pa->str)
|
||||
|
@ -11107,7 +11107,7 @@ int insert_pointer_name(POINTER_ARRAY *pa,char * name)
|
|||
int len;
|
||||
pa->array_allocs++;
|
||||
len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
|
||||
if (!(new_array=(const char **) my_realloc(pa->typelib.type_names,
|
||||
if (!(new_array=(const char **) my_realloc(PSI_NOT_INSTRUMENTED, pa->typelib.type_names,
|
||||
len/
|
||||
(sizeof(uchar*)+sizeof(*pa->flag))*
|
||||
(sizeof(uchar*)+sizeof(*pa->flag)),
|
||||
|
@ -11230,7 +11230,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
|
|||
if (!*start)
|
||||
DBUG_VOID_RETURN; /* No input */
|
||||
|
||||
my_init_dynamic_array(&lines, sizeof(const char*), 32, 32, MYF(0));
|
||||
my_init_dynamic_array(&lines, PSI_NOT_INSTRUMENTED, sizeof(const char*), 32, 32, MYF(0));
|
||||
|
||||
if (keep_header)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,8 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
|
|||
#endif
|
||||
|
||||
if (!(line_buff=(LINE_BUFFER*)
|
||||
my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*line_buff),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
return 0;
|
||||
if (init_line_buffer(line_buff,my_fileno(file),IO_SIZE,max_size))
|
||||
{
|
||||
|
@ -93,7 +94,8 @@ LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, char * str)
|
|||
{
|
||||
if (!line_buff)
|
||||
if (!(line_buff=(LINE_BUFFER*)
|
||||
my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*line_buff),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
return 0;
|
||||
if (init_line_buffer_from_string(line_buff,str))
|
||||
{
|
||||
|
@ -114,8 +116,8 @@ init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer)
|
|||
buffer->file=file;
|
||||
buffer->bufread=size;
|
||||
buffer->max_size=max_buffer;
|
||||
if (!(buffer->buffer = (char*) my_malloc(buffer->bufread+1,
|
||||
MYF(MY_WME | MY_FAE))))
|
||||
if (!(buffer->buffer = (char*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
buffer->bufread+1, MYF(MY_WME | MY_FAE))))
|
||||
return 1;
|
||||
buffer->end_of_line=buffer->end=buffer->buffer;
|
||||
buffer->buffer[0]=0; /* For easy start test */
|
||||
|
@ -132,8 +134,8 @@ static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str)
|
|||
uint old_length=(uint)(buffer->end - buffer->buffer);
|
||||
uint length= (uint) strlen(str);
|
||||
if (!(buffer->buffer= buffer->start_of_line= buffer->end_of_line=
|
||||
(char*) my_realloc((uchar*) buffer->buffer, old_length+length+2,
|
||||
MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
|
||||
(char*) my_realloc(PSI_NOT_INSTRUMENTED, buffer->buffer,
|
||||
old_length+length+2, MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
|
||||
return 1;
|
||||
buffer->end= buffer->buffer + old_length;
|
||||
if (old_length)
|
||||
|
@ -179,8 +181,8 @@ static size_t fill_buffer(LINE_BUFFER *buffer)
|
|||
return 0;
|
||||
}
|
||||
buffer->bufread *= 2;
|
||||
if (!(buffer->buffer = (char*) my_realloc(buffer->buffer,
|
||||
buffer->bufread+1,
|
||||
if (!(buffer->buffer = (char*) my_realloc(PSI_NOT_INSTRUMENTED,
|
||||
buffer->buffer, buffer->bufread+1,
|
||||
MYF(MY_WME | MY_FAE))))
|
||||
{
|
||||
buffer->error= my_errno;
|
||||
|
|
|
@ -886,7 +886,7 @@ static char *get_word(char **str)
|
|||
DBUG_ENTER("get_word");
|
||||
|
||||
*str= find_end_of_word(start);
|
||||
DBUG_RETURN(my_strndup(start, (uint) (*str - start),
|
||||
DBUG_RETURN(my_strndup(PSI_NOT_INSTRUMENTED, start, (uint) (*str - start),
|
||||
MYF(MY_WME | MY_FAE)));
|
||||
}
|
||||
|
||||
|
@ -920,7 +920,7 @@ static struct message *parse_message_string(struct message *new_message,
|
|||
while (*str != ' ' && *str != '\t' && *str)
|
||||
str++;
|
||||
if (!(new_message->lang_short_name=
|
||||
my_strndup(start, (uint) (str - start),
|
||||
my_strndup(PSI_NOT_INSTRUMENTED, start, (uint) (str - start),
|
||||
MYF(MY_WME | MY_FAE))))
|
||||
DBUG_RETURN(0); /* Fatal error */
|
||||
DBUG_PRINT("info", ("msg_slang: %s", new_message->lang_short_name));
|
||||
|
@ -940,9 +940,9 @@ static struct message *parse_message_string(struct message *new_message,
|
|||
start= str + 1;
|
||||
str= parse_text_line(start);
|
||||
|
||||
if (!(new_message->text= my_strndup(start, (uint) (str - start),
|
||||
MYF(MY_WME | MY_FAE))))
|
||||
DBUG_RETURN(0); /* Fatal error */
|
||||
if (!(new_message->text= my_strndup(PSI_NOT_INSTRUMENTED, start,
|
||||
(uint) (str - start), MYF(MY_WME | MY_FAE))))
|
||||
DBUG_RETURN(0);
|
||||
DBUG_PRINT("info", ("msg_text: %s", new_message->text));
|
||||
|
||||
DBUG_RETURN(new_message);
|
||||
|
@ -955,11 +955,11 @@ static struct errors *generate_empty_message(uint d_code, my_bool skip)
|
|||
struct message message;
|
||||
|
||||
/* create a new element */
|
||||
if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
|
||||
MYF(MY_WME))))
|
||||
if (!(new_error= (struct errors *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(*new_error), MYF(MY_WME))))
|
||||
return(0);
|
||||
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1,
|
||||
MYF(0)))
|
||||
if (my_init_dynamic_array(&new_error->msg, PSI_NOT_INSTRUMENTED,
|
||||
sizeof(struct message), 0, 1, MYF(0)))
|
||||
return(0); /* OOM: Fatal error */
|
||||
|
||||
new_error->er_name= NULL;
|
||||
|
@ -970,8 +970,10 @@ static struct errors *generate_empty_message(uint d_code, my_bool skip)
|
|||
|
||||
message.text= 0; /* If skip set, don't generate a text */
|
||||
|
||||
if (!(message.lang_short_name= my_strdup(default_language, MYF(MY_WME))) ||
|
||||
(!skip && !(message.text= my_strdup("", MYF(MY_WME)))))
|
||||
if (!(message.lang_short_name= my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
default_language, MYF(MY_WME))) ||
|
||||
(!skip && !(message.text= my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
"", MYF(MY_WME)))))
|
||||
return(0);
|
||||
|
||||
/* Can't fail as msg is preallocated */
|
||||
|
@ -992,13 +994,14 @@ static struct errors *parse_error_string(char *str, int er_count)
|
|||
DBUG_PRINT("enter", ("str: %s", str));
|
||||
|
||||
/* create a new element */
|
||||
if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
|
||||
MYF(MY_WME))))
|
||||
if (!(new_error= (struct errors *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(*new_error), MYF(MY_WME))))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
new_error->next_error= 0;
|
||||
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0, MYF(0)))
|
||||
DBUG_RETURN(0); /* OOM: Fatal error */
|
||||
if (my_init_dynamic_array(&new_error->msg, PSI_NOT_INSTRUMENTED,
|
||||
sizeof(struct message), 0, 0, MYF(0)))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
/* getting the error name */
|
||||
str= skip_delimiters(str);
|
||||
|
@ -1084,7 +1087,8 @@ static struct languages *parse_charset_string(char *str)
|
|||
do
|
||||
{
|
||||
/*creating new element of the linked list */
|
||||
new_lang= (struct languages *) my_malloc(sizeof(*new_lang), MYF(MY_WME));
|
||||
new_lang= (struct languages *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(*new_lang), MYF(MY_WME));
|
||||
new_lang->next_lang= head;
|
||||
head= new_lang;
|
||||
|
||||
|
|
|
@ -462,23 +462,23 @@ get_mysql_vars(MYSQL *connection)
|
|||
}
|
||||
|
||||
if (innodb_data_file_path_var && *innodb_data_file_path_var) {
|
||||
innobase_data_file_path = my_strdup(
|
||||
innobase_data_file_path = my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
innodb_data_file_path_var, MYF(MY_FAE));
|
||||
}
|
||||
|
||||
if (innodb_data_home_dir_var) {
|
||||
innobase_data_home_dir = my_strdup(
|
||||
innobase_data_home_dir = my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
innodb_data_home_dir_var, MYF(MY_FAE));
|
||||
}
|
||||
|
||||
if (innodb_log_group_home_dir_var
|
||||
&& *innodb_log_group_home_dir_var) {
|
||||
srv_log_group_home_dir = my_strdup(
|
||||
srv_log_group_home_dir = my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
innodb_log_group_home_dir_var, MYF(MY_FAE));
|
||||
}
|
||||
|
||||
if (innodb_undo_directory_var && *innodb_undo_directory_var) {
|
||||
srv_undo_dir = my_strdup(
|
||||
srv_undo_dir = my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
innodb_undo_directory_var, MYF(MY_FAE));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@ buffer_init(const char *root)
|
|||
ds_ctxt_t *ctxt;
|
||||
ds_buffer_ctxt_t *buffer_ctxt;
|
||||
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t),
|
||||
MYF(MY_FAE));
|
||||
ctxt = (ds_ctxt_t *)my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t), MYF(MY_FAE));
|
||||
buffer_ctxt = (ds_buffer_ctxt_t *) (ctxt + 1);
|
||||
buffer_ctxt->buffer_size = DS_DEFAULT_BUFFER_SIZE;
|
||||
|
||||
ctxt->ptr = buffer_ctxt;
|
||||
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
||||
ctxt->root = my_strdup(PSI_NOT_INSTRUMENTED, root, MYF(MY_FAE));
|
||||
|
||||
return ctxt;
|
||||
}
|
||||
|
@ -101,9 +101,8 @@ buffer_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
|
|||
|
||||
buffer_ctxt = (ds_buffer_ctxt_t *) ctxt->ptr;
|
||||
|
||||
file = (ds_file_t *) my_malloc(sizeof(ds_file_t) +
|
||||
sizeof(ds_buffer_file_t) +
|
||||
buffer_ctxt->buffer_size,
|
||||
file = (ds_file_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(ds_file_t) +
|
||||
sizeof(ds_buffer_file_t) + buffer_ctxt->buffer_size,
|
||||
MYF(MY_FAE));
|
||||
|
||||
buffer_file = (ds_buffer_file_t *) (file + 1);
|
||||
|
|
|
@ -100,16 +100,15 @@ compress_init(const char *root)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ctxt = (ds_ctxt_t *) my_malloc(sizeof(ds_ctxt_t) +
|
||||
sizeof(ds_compress_ctxt_t),
|
||||
MYF(MY_FAE));
|
||||
ctxt = (ds_ctxt_t *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(ds_ctxt_t) + sizeof(ds_compress_ctxt_t), MYF(MY_FAE));
|
||||
|
||||
compress_ctxt = (ds_compress_ctxt_t *) (ctxt + 1);
|
||||
compress_ctxt->threads = threads;
|
||||
compress_ctxt->nthreads = xtrabackup_compress_threads;
|
||||
|
||||
ctxt->ptr = compress_ctxt;
|
||||
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
||||
ctxt->root = my_strdup(PSI_NOT_INSTRUMENTED, root, MYF(MY_FAE));
|
||||
|
||||
return ctxt;
|
||||
}
|
||||
|
@ -159,9 +158,8 @@ compress_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
|
|||
goto err;
|
||||
}
|
||||
|
||||
file = (ds_file_t *) my_malloc(sizeof(ds_file_t) +
|
||||
sizeof(ds_compress_file_t),
|
||||
MYF(MY_FAE));
|
||||
file = (ds_file_t *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(ds_file_t) + sizeof(ds_compress_file_t), MYF(MY_FAE));
|
||||
comp_file = (ds_compress_file_t *) (file + 1);
|
||||
comp_file->dest_file = dest_file;
|
||||
comp_file->comp_ctxt = comp_ctxt;
|
||||
|
@ -336,8 +334,8 @@ create_worker_threads(uint n)
|
|||
comp_thread_ctxt_t *threads;
|
||||
uint i;
|
||||
|
||||
threads = (comp_thread_ctxt_t *)
|
||||
my_malloc(sizeof(comp_thread_ctxt_t) * n, MYF(MY_FAE));
|
||||
threads = (comp_thread_ctxt_t *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(comp_thread_ctxt_t) * n, MYF(MY_FAE));
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
comp_thread_ctxt_t *thd = threads + i;
|
||||
|
@ -347,9 +345,8 @@ create_worker_threads(uint n)
|
|||
thd->cancelled = FALSE;
|
||||
thd->data_avail = FALSE;
|
||||
|
||||
thd->to = (char *) my_malloc(COMPRESS_CHUNK_SIZE +
|
||||
MY_QLZ_COMPRESS_OVERHEAD,
|
||||
MYF(MY_FAE));
|
||||
thd->to = (char *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
COMPRESS_CHUNK_SIZE + MY_QLZ_COMPRESS_OVERHEAD, MYF(MY_FAE));
|
||||
|
||||
/* Initialize the control mutex and condition var */
|
||||
if (pthread_mutex_init(&thd->ctrl_mutex, NULL) ||
|
||||
|
|
|
@ -69,9 +69,9 @@ local_init(const char *root)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
|
||||
ctxt = (ds_ctxt_t *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(ds_ctxt_t), MYF(MY_FAE));
|
||||
|
||||
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
||||
ctxt->root = my_strdup(PSI_NOT_INSTRUMENTED, root, MYF(MY_FAE));
|
||||
|
||||
return ctxt;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ local_open(ds_ctxt_t *ctxt, const char *path,
|
|||
|
||||
path_len = strlen(fullpath) + 1; /* terminating '\0' */
|
||||
|
||||
file = (ds_file_t *) my_malloc(sizeof(ds_file_t) +
|
||||
file = (ds_file_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(ds_file_t) +
|
||||
sizeof(ds_local_file_t) +
|
||||
path_len,
|
||||
MYF(MY_FAE));
|
||||
|
|
|
@ -49,9 +49,9 @@ stdout_init(const char *root)
|
|||
{
|
||||
ds_ctxt_t *ctxt;
|
||||
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
|
||||
ctxt = (ds_ctxt_t *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(ds_ctxt_t), MYF(MY_FAE));
|
||||
|
||||
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
||||
ctxt->root = my_strdup(PSI_NOT_INSTRUMENTED, root, MYF(MY_FAE));
|
||||
|
||||
return ctxt;
|
||||
}
|
||||
|
@ -69,10 +69,8 @@ stdout_open(ds_ctxt_t *ctxt __attribute__((unused)),
|
|||
|
||||
pathlen = strlen(fullpath) + 1;
|
||||
|
||||
file = (ds_file_t *) my_malloc(sizeof(ds_file_t) +
|
||||
sizeof(ds_stdout_file_t) +
|
||||
pathlen,
|
||||
MYF(MY_FAE));
|
||||
file = (ds_file_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(ds_file_t) +
|
||||
sizeof(ds_stdout_file_t) + pathlen, MYF(MY_FAE));
|
||||
stdout_file = (ds_stdout_file_t *) (file + 1);
|
||||
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ tmpfile_init(const char *root)
|
|||
ds_ctxt_t *ctxt;
|
||||
ds_tmpfile_ctxt_t *tmpfile_ctxt;
|
||||
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t),
|
||||
MYF(MY_FAE));
|
||||
ctxt = (ds_ctxt_t *)my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t), MYF(MY_FAE));
|
||||
tmpfile_ctxt = (ds_tmpfile_ctxt_t *) (ctxt + 1);
|
||||
tmpfile_ctxt->file_list = NULL;
|
||||
if (pthread_mutex_init(&tmpfile_ctxt->mutex, NULL)) {
|
||||
|
@ -72,7 +72,7 @@ tmpfile_init(const char *root)
|
|||
}
|
||||
|
||||
ctxt->ptr = tmpfile_ctxt;
|
||||
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
||||
ctxt->root = my_strdup(PSI_NOT_INSTRUMENTED, root, MYF(MY_FAE));
|
||||
|
||||
return ctxt;
|
||||
}
|
||||
|
@ -100,9 +100,8 @@ tmpfile_open(ds_ctxt_t *ctxt, const char *path,
|
|||
|
||||
path_len = strlen(path) + 1; /* terminating '\0' */
|
||||
|
||||
file = (ds_file_t *) my_malloc(sizeof(ds_file_t) +
|
||||
sizeof(ds_tmp_file_t) + path_len,
|
||||
MYF(MY_FAE));
|
||||
file = (ds_file_t *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(ds_file_t) + sizeof(ds_tmp_file_t) + path_len, MYF(MY_FAE));
|
||||
|
||||
tmp_file = (ds_tmp_file_t *) (file + 1);
|
||||
tmp_file->file = file;
|
||||
|
@ -114,7 +113,7 @@ tmpfile_open(ds_ctxt_t *ctxt, const char *path,
|
|||
memcpy(tmp_file->orig_path, path, path_len);
|
||||
|
||||
/* Store the real temporary file name in file->path */
|
||||
file->path = my_strdup(tmp_path, MYF(MY_FAE));
|
||||
file->path = my_strdup(PSI_NOT_INSTRUMENTED, tmp_path, MYF(MY_FAE));
|
||||
file->ptr = tmp_file;
|
||||
|
||||
/* Store the file object in the list to be piped later */
|
||||
|
@ -170,7 +169,7 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
|
|||
pipe_ctxt = ctxt->pipe_ctxt;
|
||||
xb_a(pipe_ctxt != NULL);
|
||||
|
||||
buf = my_malloc(buf_size, MYF(MY_FAE));
|
||||
buf = my_malloc(PSI_NOT_INSTRUMENTED, buf_size, MYF(MY_FAE));
|
||||
|
||||
tmpfile_ctxt = (ds_tmpfile_ctxt_t *) ctxt->ptr;
|
||||
list = tmpfile_ctxt->file_list;
|
||||
|
|
|
@ -79,8 +79,8 @@ xbstream_init(const char *root __attribute__((unused)))
|
|||
ds_stream_ctxt_t *stream_ctxt;
|
||||
xb_wstream_t *xbstream;
|
||||
|
||||
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t),
|
||||
MYF(MY_FAE));
|
||||
ctxt = (ds_ctxt_t *)my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t), MYF(MY_FAE));
|
||||
stream_ctxt = (ds_stream_ctxt_t *)(ctxt + 1);
|
||||
|
||||
if (pthread_mutex_init(&stream_ctxt->mutex, NULL)) {
|
||||
|
@ -131,9 +131,8 @@ xbstream_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
|
|||
}
|
||||
pthread_mutex_unlock(&stream_ctxt->mutex);
|
||||
|
||||
file = (ds_file_t *) my_malloc(sizeof(ds_file_t) +
|
||||
sizeof(ds_stream_file_t),
|
||||
MYF(MY_FAE));
|
||||
file = (ds_file_t *) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(ds_file_t) + sizeof(ds_stream_file_t), MYF(MY_FAE));
|
||||
stream_file = (ds_stream_file_t *) (file + 1);
|
||||
|
||||
xbstream = stream_ctxt->xbstream;
|
||||
|
|
|
@ -774,7 +774,8 @@ ibx_get_one_option(const struct my_option *opt,
|
|||
{
|
||||
char *start = argument;
|
||||
my_free(opt_ibx_password);
|
||||
opt_ibx_password= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_ibx_password= my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
argument, MYF(MY_FAE));
|
||||
/* Destroy argument */
|
||||
while (*argument)
|
||||
*argument++= 'x';
|
||||
|
|
|
@ -226,7 +226,7 @@ stream_one_file(File file, xb_wstream_file_t *xbfile)
|
|||
posix_fadvise(file, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
offset = my_tell(file, MYF(MY_WME));
|
||||
|
||||
buf = (uchar*)(my_malloc(XBSTREAM_BUFFER_SIZE, MYF(MY_FAE)));
|
||||
buf = (uchar*)(my_malloc(PSI_NOT_INSTRUMENTED, XBSTREAM_BUFFER_SIZE, MYF(MY_FAE)));
|
||||
|
||||
while ((bytes = (ssize_t)my_read(file, buf, XBSTREAM_BUFFER_SIZE,
|
||||
MYF(MY_WME))) > 0) {
|
||||
|
@ -321,13 +321,13 @@ file_entry_new(extract_ctxt_t *ctxt, const char *path, uint pathlen)
|
|||
file_entry_t *entry;
|
||||
ds_file_t *file;
|
||||
|
||||
entry = (file_entry_t *) my_malloc(sizeof(file_entry_t),
|
||||
entry = (file_entry_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(file_entry_t),
|
||||
MYF(MY_WME | MY_ZEROFILL));
|
||||
if (entry == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entry->path = my_strndup(path, pathlen, MYF(MY_WME));
|
||||
entry->path = my_strndup(PSI_NOT_INSTRUMENTED, path, pathlen, MYF(MY_WME));
|
||||
if (entry->path == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
|||
|
||||
if (my_hash_init(&filehash, &my_charset_bin, START_FILE_HASH_SIZE,
|
||||
0, 0, (my_hash_get_key) get_file_entry_key,
|
||||
(my_hash_free_key) file_entry_free, MYF(0))) {
|
||||
(my_hash_free_key) file_entry_free, MYF(0), PSI_NOT_INSTRUMENTED)) {
|
||||
msg("%s: failed to initialize file hash.", my_progname);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ xb_stream_read_new(void)
|
|||
{
|
||||
xb_rstream_t *stream;
|
||||
|
||||
stream = (xb_rstream_t *) my_malloc(sizeof(xb_rstream_t), MYF(MY_FAE));
|
||||
stream = (xb_rstream_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(xb_rstream_t), MYF(MY_FAE));
|
||||
|
||||
#ifdef __WIN__
|
||||
setmode(fileno(stdin), _O_BINARY);
|
||||
|
@ -190,7 +190,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||
|
||||
/* Reallocate the buffer if needed */
|
||||
if (chunk->length > chunk->buflen) {
|
||||
chunk->data = my_realloc(chunk->data, chunk->length,
|
||||
chunk->data = my_realloc(PSI_NOT_INSTRUMENTED, chunk->data, chunk->length,
|
||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||
if (chunk->data == NULL) {
|
||||
msg("xb_stream_read_chunk(): failed to increase buffer "
|
||||
|
|
|
@ -65,7 +65,7 @@ xb_stream_write_new(void)
|
|||
{
|
||||
xb_wstream_t *stream;
|
||||
|
||||
stream = (xb_wstream_t *) my_malloc(sizeof(xb_wstream_t), MYF(MY_FAE));
|
||||
stream = (xb_wstream_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(xb_wstream_t), MYF(MY_FAE));
|
||||
pthread_mutex_init(&stream->mutex, NULL);
|
||||
|
||||
return stream;;
|
||||
|
@ -87,7 +87,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
file = (xb_wstream_file_t *) my_malloc(sizeof(xb_wstream_file_t) +
|
||||
file = (xb_wstream_file_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(xb_wstream_file_t) +
|
||||
path_len + 1, MYF(MY_FAE));
|
||||
|
||||
file->path = (char *) (file + 1);
|
||||
|
|
|
@ -1723,7 +1723,7 @@ xb_get_one_option(const struct my_option *opt,
|
|||
{
|
||||
char *start= argument;
|
||||
my_free(opt_password);
|
||||
opt_password= my_strdup(argument, MYF(MY_FAE));
|
||||
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; // Destroy argument
|
||||
if (*start)
|
||||
start[1]=0 ;
|
||||
|
|
|
@ -170,7 +170,8 @@ int main(int argc, char **argv)
|
|||
if (nargs < 2)
|
||||
usage();
|
||||
|
||||
load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME));
|
||||
load_default_groups=(char**) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
nargs*sizeof(char*), MYF(MY_WME));
|
||||
if (!load_default_groups)
|
||||
exit(1);
|
||||
if (opt_mysqld)
|
||||
|
|
|
@ -259,12 +259,12 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
|||
if (! pa->typelib.count)
|
||||
{
|
||||
if (!(pa->typelib.type_names=(const char **)
|
||||
my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, ((PC_MALLOC-MALLOC_OVERHEAD)/
|
||||
(sizeof(char *)+sizeof(*pa->flag))*
|
||||
(sizeof(char *)+sizeof(*pa->flag))),MYF(MY_WME))))
|
||||
DBUG_RETURN(-1);
|
||||
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
|
||||
MYF(MY_WME))))
|
||||
if (!(pa->str= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
PS_MALLOC-MALLOC_OVERHEAD, MYF(MY_WME))))
|
||||
{
|
||||
my_free((void*) pa->typelib.type_names);
|
||||
DBUG_RETURN (-1);
|
||||
|
@ -281,9 +281,8 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
|||
{
|
||||
pa->max_length=(pa->length+length+MALLOC_OVERHEAD+PS_MALLOC-1)/PS_MALLOC;
|
||||
pa->max_length=pa->max_length*PS_MALLOC-MALLOC_OVERHEAD;
|
||||
if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str,
|
||||
(uint) pa->max_length,
|
||||
MYF(MY_WME))))
|
||||
if (!(new_pos= (uchar*) my_realloc(PSI_NOT_INSTRUMENTED, (uchar*) pa->str,
|
||||
(uint) pa->max_length, MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
if (new_pos != pa->str)
|
||||
{
|
||||
|
@ -299,7 +298,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
|||
int len;
|
||||
pa->array_allocs++;
|
||||
len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
|
||||
if (!(new_array=(const char **) my_realloc((uchar*) pa->typelib.type_names,
|
||||
if (!(new_array=(const char **) my_realloc(PSI_NOT_INSTRUMENTED, (void*)(pa->typelib.type_names),
|
||||
(uint) len/
|
||||
(sizeof(uchar*)+sizeof(*pa->flag))*
|
||||
(sizeof(uchar*)+sizeof(*pa->flag)),
|
||||
|
@ -431,7 +430,8 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
if (init_sets(&sets,states))
|
||||
DBUG_RETURN(0);
|
||||
found_sets=0;
|
||||
if (!(found_set= (FOUND_SET*) my_malloc(sizeof(FOUND_SET)*max_length*count,
|
||||
if (!(found_set= (FOUND_SET*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(FOUND_SET)*max_length*count,
|
||||
MYF(MY_WME))))
|
||||
{
|
||||
free_sets(&sets);
|
||||
|
@ -442,7 +442,8 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
used_sets=-1;
|
||||
word_states=make_new_set(&sets); /* Start of new word */
|
||||
start_states=make_new_set(&sets); /* This is first state */
|
||||
if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
|
||||
if (!(follow=(FOLLOWS*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
(states+2)*sizeof(FOLLOWS), MYF(MY_WME))))
|
||||
{
|
||||
free_sets(&sets);
|
||||
my_free(found_set);
|
||||
|
@ -634,7 +635,8 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
|
||||
/* Alloc replace structure for the replace-state-machine */
|
||||
|
||||
if ((replace=(REPLACE*) my_malloc(sizeof(REPLACE)*(sets.count)+
|
||||
if ((replace=(REPLACE*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(REPLACE)*(sets.count)+
|
||||
sizeof(REPLACE_STRING)*(found_sets+1)+
|
||||
sizeof(char *)*count+result_len,
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
|
@ -679,10 +681,12 @@ static int init_sets(REP_SETS *sets,uint states)
|
|||
{
|
||||
bzero((char*) sets,sizeof(*sets));
|
||||
sets->size_of_bits=((states+7)/8);
|
||||
if (!(sets->set_buffer=(REP_SET*) my_malloc(sizeof(REP_SET)*SET_MALLOC_HUNC,
|
||||
if (!(sets->set_buffer=(REP_SET*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(REP_SET)*SET_MALLOC_HUNC,
|
||||
MYF(MY_WME))))
|
||||
return 1;
|
||||
if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
|
||||
if (!(sets->bit_buffer=(uint*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(uint)*sets->size_of_bits*
|
||||
SET_MALLOC_HUNC,MYF(MY_WME))))
|
||||
{
|
||||
my_free(sets->set);
|
||||
|
@ -717,15 +721,14 @@ static REP_SET *make_new_set(REP_SETS *sets)
|
|||
return set;
|
||||
}
|
||||
count=sets->count+sets->invisible+SET_MALLOC_HUNC;
|
||||
if (!(set=(REP_SET*) my_realloc((uchar*) sets->set_buffer,
|
||||
sizeof(REP_SET)*count,
|
||||
MYF(MY_WME))))
|
||||
if (!(set=(REP_SET*) my_realloc(PSI_NOT_INSTRUMENTED, sets->set_buffer,
|
||||
sizeof(REP_SET)*count, MYF(MY_WME))))
|
||||
return 0;
|
||||
sets->set_buffer=set;
|
||||
sets->set=set+sets->invisible;
|
||||
if (!(bit_buffer=(uint*) my_realloc((uchar*) sets->bit_buffer,
|
||||
(sizeof(uint)*sets->size_of_bits)*count,
|
||||
MYF(MY_WME))))
|
||||
if (!(bit_buffer=(uint*) my_realloc(PSI_NOT_INSTRUMENTED, sets->bit_buffer,
|
||||
(sizeof(uint)*sets->size_of_bits)*count,
|
||||
MYF(MY_WME))))
|
||||
return 0;
|
||||
sets->bit_buffer=bit_buffer;
|
||||
for (i=0 ; i < count ; i++)
|
||||
|
@ -898,7 +901,7 @@ static uint replace_strings(REPLACE *rep, char **start, uint *max_length,
|
|||
if (to == end)
|
||||
{
|
||||
(*max_length)+=8192;
|
||||
if (!(new=my_realloc(*start,*max_length,MYF(MY_WME))))
|
||||
if (!(new=my_realloc(PSI_NOT_INSTRUMENTED, *start,*max_length,MYF(MY_WME))))
|
||||
return (uint) -1;
|
||||
to=new+(to - *start);
|
||||
end=(*start=new)+ *max_length-1;
|
||||
|
@ -914,7 +917,7 @@ static uint replace_strings(REPLACE *rep, char **start, uint *max_length,
|
|||
if (to == end)
|
||||
{
|
||||
(*max_length)*=2;
|
||||
if (!(new=my_realloc(*start,*max_length,MYF(MY_WME))))
|
||||
if (!(new=my_realloc(PSI_NOT_INSTRUMENTED, *start,*max_length,MYF(MY_WME))))
|
||||
return (uint) -1;
|
||||
to=new+(to - *start);
|
||||
end=(*start=new)+ *max_length-1;
|
||||
|
@ -938,11 +941,11 @@ static int initialize_buffer()
|
|||
{
|
||||
bufread = 8192;
|
||||
bufalloc = bufread + bufread / 2;
|
||||
if (!(buffer = my_malloc(bufalloc+1,MYF(MY_WME))))
|
||||
if (!(buffer = my_malloc(PSI_NOT_INSTRUMENTED, bufalloc+1, MYF(MY_WME))))
|
||||
return 1;
|
||||
bufbytes=my_eof=0;
|
||||
out_length=bufread;
|
||||
if (!(out_buff=my_malloc(out_length,MYF(MY_WME))))
|
||||
if (!(out_buff=my_malloc(PSI_NOT_INSTRUMENTED, out_length, MYF(MY_WME))))
|
||||
return(1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -979,7 +982,7 @@ int n;
|
|||
bufalloc *= 2;
|
||||
bufread *= 2;
|
||||
}
|
||||
buffer = my_realloc(buffer, bufalloc+1, MYF(MY_WME));
|
||||
buffer = my_realloc(PSI_NOT_INSTRUMENTED, buffer, bufalloc+1, MYF(MY_WME));
|
||||
if (! buffer)
|
||||
return(-1);
|
||||
}
|
||||
|
|
|
@ -224,8 +224,8 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf)
|
|||
static void init_sym_table()
|
||||
{
|
||||
char buf[512];
|
||||
if (my_init_dynamic_array(&sym_table, sizeof(SYM_ENTRY), INIT_SYM_TABLE,
|
||||
INC_SYM_TABLE, MYF(0)))
|
||||
if (my_init_dynamic_array(&sym_table, PSI_NOT_INSTRUMENTED, sizeof(SYM_ENTRY),
|
||||
INIT_SYM_TABLE, INC_SYM_TABLE, MYF(0)))
|
||||
die("Failed in my_init_dynamic_array() -- looks like out of memory problem");
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp_sym))
|
||||
|
|
|
@ -63,13 +63,13 @@ typedef struct st_hash {
|
|||
/* A search iterator state */
|
||||
typedef uint HASH_SEARCH_STATE;
|
||||
|
||||
#define my_hash_init(A,B,C,D,E,F,G,H) my_hash_init2(A,0,B,C,D,E,F,0,G,H)
|
||||
#define my_hash_init(A,B,C,D,E,F,G,H,I) my_hash_init2(A,0,B,C,D,E,F,0,G,H,I)
|
||||
my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
|
||||
ulong default_array_elements, size_t key_offset,
|
||||
size_t key_length, my_hash_get_key get_key,
|
||||
my_hash_function hash_function,
|
||||
void (*free_element)(void*),
|
||||
uint flags);
|
||||
uint flags, PSI_memory_key psi_key);
|
||||
void my_hash_free(HASH *tree);
|
||||
void my_hash_reset(HASH *hash);
|
||||
uchar *my_hash_element(HASH *hash, size_t idx);
|
||||
|
@ -99,8 +99,8 @@ my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument);
|
|||
|
||||
#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
|
||||
#define my_hash_inited(H) ((H)->blength != 0)
|
||||
#define my_hash_init_opt(A,B,C,D,E,F,G,H) \
|
||||
(!my_hash_inited(A) && my_hash_init(A,B,C,D,E,F,G,H))
|
||||
#define my_hash_init_opt(A,B,C,D,E,F,G,H, I) \
|
||||
(!my_hash_inited(A) && my_hash_init(A,B,C,D,E,F,G,H, I))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef _my_alloc_h
|
||||
#define _my_alloc_h
|
||||
|
||||
#include <mysql/psi/psi_memory.h>
|
||||
|
||||
#define ALLOC_MAX_BLOCK_TO_DROP 4096
|
||||
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
|
||||
|
||||
|
@ -43,7 +45,6 @@ typedef struct st_mem_root
|
|||
/* if block have less memory it will be put in 'used' list */
|
||||
size_t min_malloc;
|
||||
size_t block_size; /* initial block size */
|
||||
size_t total_alloc;
|
||||
unsigned int block_num; /* allocated blocks counter */
|
||||
/*
|
||||
first free block in queue test counter (if it exceed
|
||||
|
@ -52,7 +53,8 @@ typedef struct st_mem_root
|
|||
unsigned int first_block_usage;
|
||||
|
||||
void (*error_handler)(void);
|
||||
const char *name;
|
||||
|
||||
PSI_memory_key m_psi_key;
|
||||
} MEM_ROOT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -68,14 +68,14 @@ do \
|
|||
else \
|
||||
{ \
|
||||
(must_be_freed)= 1; \
|
||||
(res)= my_malloc(size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \
|
||||
(res)= my_malloc(PSI_INSTRUMENT_ME, size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define alloc_on_stack(stack_end, res, must_be_freed, size) \
|
||||
do { \
|
||||
(must_be_freed)= 1; \
|
||||
(res)= my_malloc(size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \
|
||||
(res)= my_malloc(PSI_INSTRUMENT_ME, size, MYF(MY_THREAD_SPECIFIC | MY_WME)); \
|
||||
} while(0)
|
||||
#endif /* HAVE_ALLOCA */
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define _my_sys_h
|
||||
|
||||
#include <m_string.h>
|
||||
#include <mysql/psi/mysql_memory.h>
|
||||
|
||||
C_MODE_START
|
||||
|
||||
|
@ -89,14 +90,12 @@ typedef struct my_aio_result {
|
|||
#define MY_ZEROFILL 32U /* my_malloc(), fill array with zero */
|
||||
#define MY_ALLOW_ZERO_PTR 64U /* my_realloc() ; zero ptr -> malloc */
|
||||
#define MY_FREE_ON_ERROR 128U /* my_realloc() ; Free old ptr on error */
|
||||
#define MY_HOLD_ON_ERROR 256U /* my_realloc() ; Return old ptr on error */
|
||||
#define MY_DONT_OVERWRITE_FILE 2048U /* my_copy: Don't overwrite file */
|
||||
#define MY_THREADSAFE 2048U /* my_seek(): lock fd mutex */
|
||||
#define MY_SYNC 4096U /* my_copy(): sync dst file */
|
||||
#define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */
|
||||
#define MY_SYNC_FILESIZE 65536U /* my_sync(): safe sync when file is extended */
|
||||
#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */
|
||||
#define MY_THREAD_MOVE 0x20000U /* realloc(); Memory can move */
|
||||
/* Tree that should delete things automatically */
|
||||
#define MY_TREE_WITH_DELETE 0x40000U
|
||||
|
||||
|
@ -168,14 +167,14 @@ typedef void (*MALLOC_SIZE_CB) (long long size, my_bool is_thread_specific);
|
|||
extern void set_malloc_size_cb(MALLOC_SIZE_CB func);
|
||||
|
||||
/* defines when allocating data */
|
||||
extern void *my_malloc(size_t Size,myf MyFlags);
|
||||
extern void *my_multi_malloc(myf MyFlags, ...);
|
||||
extern void *my_multi_malloc_large(myf MyFlags, ...);
|
||||
extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
|
||||
extern void *my_malloc(PSI_memory_key key, size_t size, myf MyFlags);
|
||||
extern void *my_multi_malloc(PSI_memory_key key, myf MyFlags, ...);
|
||||
extern void *my_multi_malloc_large(PSI_memory_key key, myf MyFlags, ...);
|
||||
extern void *my_realloc(PSI_memory_key key, void *ptr, size_t size, myf MyFlags);
|
||||
extern void my_free(void *ptr);
|
||||
extern void *my_memdup(const void *from,size_t length,myf MyFlags);
|
||||
extern char *my_strdup(const char *from,myf MyFlags);
|
||||
extern char *my_strndup(const char *from, size_t length, myf MyFlags);
|
||||
extern void *my_memdup(PSI_memory_key key, const void *from,size_t length,myf MyFlags);
|
||||
extern char *my_strdup(PSI_memory_key key, const char *from,myf MyFlags);
|
||||
extern char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf MyFlags);
|
||||
|
||||
#ifdef HAVE_LINUX_LARGE_PAGES
|
||||
extern uint my_get_large_page_size(void);
|
||||
|
@ -211,11 +210,11 @@ extern my_bool my_may_have_atomic_write;
|
|||
#define MAX_ALLOCA_SZ 4096
|
||||
#define my_safe_alloca(size) (((size) <= MAX_ALLOCA_SZ) ? \
|
||||
my_alloca(size) : \
|
||||
my_malloc((size), MYF(MY_THREAD_SPECIFIC|MY_WME)))
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, (size), MYF(MY_THREAD_SPECIFIC|MY_WME)))
|
||||
#define my_safe_afree(ptr, size) \
|
||||
do { if ((size) > MAX_ALLOCA_SZ) my_free(ptr); } while(0)
|
||||
#else
|
||||
#define my_alloca(SZ) my_malloc(SZ,MYF(MY_FAE))
|
||||
#define my_alloca(SZ) my_malloc(PSI_NOT_INSTRUMENTED, SZ,MYF(MY_FAE))
|
||||
#define my_afree(PTR) my_free(PTR)
|
||||
#define my_safe_alloca(size) my_alloca(size)
|
||||
#define my_safe_afree(ptr, size) my_afree(ptr)
|
||||
|
@ -353,6 +352,7 @@ typedef struct st_dynamic_array
|
|||
uint elements,max_element;
|
||||
uint alloc_increment;
|
||||
uint size_of_element;
|
||||
PSI_memory_key m_psi_key;
|
||||
myf malloc_flags;
|
||||
} DYNAMIC_ARRAY;
|
||||
|
||||
|
@ -835,11 +835,12 @@ extern my_bool real_open_cached_file(IO_CACHE *cache);
|
|||
extern void close_cached_file(IO_CACHE *cache);
|
||||
File create_temp_file(char *to, const char *dir, const char *pfx,
|
||||
int mode, myf MyFlags);
|
||||
#define my_init_dynamic_array(A,B,C,D,E) init_dynamic_array2(A,B,NULL,C,D,E)
|
||||
#define my_init_dynamic_array2(A,B,C,D,E,F) init_dynamic_array2(A,B,C,D,E,F)
|
||||
extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
|
||||
void *init_buffer, uint init_alloc,
|
||||
uint alloc_increment, myf my_flags);
|
||||
#define my_init_dynamic_array(A,B,C,D,E,F) init_dynamic_array2(A,B,C,NULL,D,E,F)
|
||||
#define my_init_dynamic_array2(A,B,C,D,E,F,G) init_dynamic_array2(A,B,C,D,E,F,G)
|
||||
extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, PSI_memory_key psi_key,
|
||||
uint element_size, void *init_buffer,
|
||||
uint init_alloc, uint alloc_increment,
|
||||
myf my_flags);
|
||||
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void* element);
|
||||
extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
|
||||
extern void *pop_dynamic(DYNAMIC_ARRAY*);
|
||||
|
@ -886,13 +887,14 @@ extern uint32 copy_and_convert_extended(char *to, uint32 to_length,
|
|||
extern void *my_malloc_lock(size_t length,myf flags);
|
||||
extern void my_free_lock(void *ptr);
|
||||
#else
|
||||
#define my_malloc_lock(A,B) my_malloc((A),(B))
|
||||
#define my_malloc_lock(A,B) my_malloc(PSI_INSTRUMENT_ME, (A),(B))
|
||||
#define my_free_lock(A) my_free((A))
|
||||
#endif
|
||||
#define root_name(A) ""
|
||||
#define alloc_root_inited(A) ((A)->min_malloc != 0)
|
||||
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
|
||||
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
|
||||
extern void init_alloc_root(MEM_ROOT *mem_root, const char *name,
|
||||
extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root,
|
||||
size_t block_size, size_t pre_alloc_size,
|
||||
myf my_flags);
|
||||
extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
|
||||
|
|
|
@ -240,6 +240,12 @@ typedef char **MYSQL_ROW;
|
|||
typedef unsigned int MYSQL_FIELD_OFFSET;
|
||||
typedef unsigned long long my_ulonglong;
|
||||
extern "C" {
|
||||
}
|
||||
extern "C" {
|
||||
struct PSI_thread;
|
||||
typedef unsigned int PSI_memory_key;
|
||||
}
|
||||
extern "C" {
|
||||
typedef struct st_used_mem
|
||||
{
|
||||
struct st_used_mem *next;
|
||||
|
@ -253,11 +259,10 @@ typedef struct st_mem_root
|
|||
USED_MEM *pre_alloc;
|
||||
size_t min_malloc;
|
||||
size_t block_size;
|
||||
size_t total_alloc;
|
||||
unsigned int block_num;
|
||||
unsigned int first_block_usage;
|
||||
void (*error_handler)(void);
|
||||
const char *name;
|
||||
PSI_memory_key m_psi_key;
|
||||
} MEM_ROOT;
|
||||
}
|
||||
typedef struct st_typelib {
|
||||
|
|
|
@ -418,7 +418,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
|
|||
|
||||
if (!data)
|
||||
goto err;
|
||||
init_alloc_root(&data->alloc, "embedded_query_cache", 8192,0,MYF(0));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &data->alloc, 8192, 0, MYF(0));
|
||||
f_alloc= &data->alloc;
|
||||
|
||||
data->fields= src->load_int();
|
||||
|
|
|
@ -491,8 +491,8 @@ char **copy_arguments(int argc, char **argv)
|
|||
for (from=argv ; from != end ; from++)
|
||||
length+= strlen(*from);
|
||||
|
||||
if ((res= (char**) my_malloc(sizeof(argv)*(argc+1)+length+argc,
|
||||
MYF(MY_WME))))
|
||||
if ((res= (char**) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(argv)*(argc+1)+length+argc, MYF(MY_WME))))
|
||||
{
|
||||
char **to= res, *to_str= (char*) (res+argc+1);
|
||||
for (from=argv ; from != end ;)
|
||||
|
@ -664,7 +664,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
|
|||
thd->mysql= mysql;
|
||||
mysql->server_version= server_version;
|
||||
mysql->client_flag= client_flag;
|
||||
init_alloc_root(&mysql->field_alloc, "fields", 8192, 0, MYF(0));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &mysql->field_alloc, 8192, 0, MYF(0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -758,7 +758,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db)
|
|||
sctx->host_or_ip= sctx->host= (char*) my_localhost;
|
||||
strmake_buf(sctx->priv_host, (char*) my_localhost);
|
||||
strmake_buf(sctx->priv_user, mysql->user);
|
||||
sctx->user= my_strdup(mysql->user, MYF(0));
|
||||
sctx->user= my_strdup(PSI_NOT_INSTRUMENTED, mysql->user, MYF(0));
|
||||
sctx->proxy_user[0]= 0;
|
||||
sctx->master_access= GLOBAL_ACLS; // Full rights
|
||||
emb_transfer_connect_attrs(mysql);
|
||||
|
@ -918,10 +918,8 @@ MYSQL_DATA *THD::alloc_new_dataset()
|
|||
{
|
||||
MYSQL_DATA *data;
|
||||
struct embedded_query_result *emb_data;
|
||||
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
|
||||
&data, sizeof(*data),
|
||||
&emb_data, sizeof(*emb_data),
|
||||
NULL))
|
||||
if (!my_multi_malloc(PSI_NOT_INSTRUMENTED, MYF(MY_WME | MY_ZEROFILL),
|
||||
&data, sizeof(*data), &emb_data, sizeof(*emb_data), NULL))
|
||||
return NULL;
|
||||
|
||||
emb_data->prev_ptr= &data->data;
|
||||
|
@ -984,7 +982,7 @@ bool Protocol::begin_dataset()
|
|||
return 1;
|
||||
alloc= &data->alloc;
|
||||
/* Assume rowlength < 8192 */
|
||||
init_alloc_root(alloc, "protocol", 8192, 0, MYF(0));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, alloc, 8192, 0, MYF(0));
|
||||
alloc->min_malloc= sizeof(MYSQL_ROWS);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -399,9 +399,9 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||
my_free(saved_db);
|
||||
|
||||
/* alloc new connect information */
|
||||
mysql->user= my_strdup(mysql->user, MYF(MY_WME));
|
||||
mysql->passwd= my_strdup(mysql->passwd, MYF(MY_WME));
|
||||
mysql->db= db ? my_strdup(db, MYF(MY_WME)) : 0;
|
||||
mysql->user= my_strdup(PSI_NOT_INSTRUMENTED, mysql->user, MYF(MY_WME));
|
||||
mysql->passwd= my_strdup(PSI_NOT_INSTRUMENTED, mysql->passwd, MYF(MY_WME));
|
||||
mysql->db= db ? my_strdup(PSI_NOT_INSTRUMENTED, db, MYF(MY_WME)) : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -482,7 +482,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
|
|||
}
|
||||
|
||||
/* copy filename into local memory and allocate read buffer */
|
||||
if (!(buf=my_malloc(packet_length, MYF(0))))
|
||||
if (!(buf=my_malloc(PSI_NOT_INSTRUMENTED, packet_length, MYF(0))))
|
||||
{
|
||||
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
|
@ -580,7 +580,8 @@ static int default_local_infile_init(void **ptr, const char *filename,
|
|||
char tmp_name[FN_REFLEN];
|
||||
|
||||
if (!(*ptr= data= ((default_local_infile_data *)
|
||||
my_malloc(sizeof(default_local_infile_data), MYF(0)))))
|
||||
my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(default_local_infile_data), MYF(0)))))
|
||||
return 1; /* out of memory */
|
||||
|
||||
data->error_msg[0]= 0;
|
||||
|
@ -865,7 +866,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
|
|||
!(fields= (*mysql->methods->list_fields)(mysql)))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES),
|
||||
if (!(result = (MYSQL_RES *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(MYSQL_RES),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
|
@ -1543,10 +1544,10 @@ mysql_stmt_init(MYSQL *mysql)
|
|||
DBUG_ENTER("mysql_stmt_init");
|
||||
|
||||
if (!(stmt=
|
||||
(MYSQL_STMT *) my_malloc(sizeof (MYSQL_STMT),
|
||||
(MYSQL_STMT *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof (MYSQL_STMT),
|
||||
MYF(MY_WME | MY_ZEROFILL))) ||
|
||||
!(stmt->extension=
|
||||
(MYSQL_STMT_EXT *) my_malloc(sizeof (MYSQL_STMT_EXT),
|
||||
(MYSQL_STMT_EXT *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof (MYSQL_STMT_EXT),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
|
@ -1554,9 +1555,8 @@ mysql_stmt_init(MYSQL *mysql)
|
|||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
init_alloc_root(&stmt->mem_root, "stmt", 2048,2048, MYF(MY_THREAD_SPECIFIC));
|
||||
init_alloc_root(&stmt->result.alloc, "result", 4096, 4096,
|
||||
MYF(MY_THREAD_SPECIFIC));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &stmt->mem_root, 2048,2048, MYF(MY_THREAD_SPECIFIC));
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
|
||||
stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS);
|
||||
mysql->stmts= list_add(mysql->stmts, &stmt->list);
|
||||
stmt->list.data= stmt;
|
||||
|
@ -1567,7 +1567,7 @@ mysql_stmt_init(MYSQL *mysql)
|
|||
strmov(stmt->sqlstate, not_error_sqlstate);
|
||||
/* The rest of statement members was bzeroed inside malloc */
|
||||
|
||||
init_alloc_root(&stmt->extension->fields_mem_root, "extension", 2048, 0,
|
||||
init_alloc_root(PSI_NOT_INSTRUMENTED, &stmt->extension->fields_mem_root, 2048, 0,
|
||||
MYF(MY_THREAD_SPECIFIC));
|
||||
|
||||
DBUG_RETURN(stmt);
|
||||
|
@ -1854,7 +1854,7 @@ mysql_stmt_result_metadata(MYSQL_STMT *stmt)
|
|||
if (!stmt->field_count)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result),
|
||||
if (!(result=(MYSQL_RES*) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*result),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL);
|
||||
|
@ -2212,7 +2212,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
|
|||
}
|
||||
length= (ulong) (net->write_pos - net->buff);
|
||||
/* TODO: Look into avoding the following memdup */
|
||||
if (!(param_data= my_memdup(net->buff, length, MYF(0))))
|
||||
if (!(param_data= my_memdup(PSI_NOT_INSTRUMENTED, net->buff, length, MYF(0))))
|
||||
{
|
||||
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL);
|
||||
DBUG_RETURN(1);
|
||||
|
|
|
@ -157,7 +157,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||
put extra 'my_free's in mysql_close.
|
||||
So we alloc it with the 'user' string to be freed at once
|
||||
*/
|
||||
mysql->user= my_strdup(user, MYF(0));
|
||||
mysql->user= my_strdup(PSI_NOT_INSTRUMENTED, user, MYF(0));
|
||||
|
||||
port=0;
|
||||
unix_socket=0;
|
||||
|
@ -175,7 +175,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||
if (db)
|
||||
client_flag|=CLIENT_CONNECT_WITH_DB;
|
||||
|
||||
mysql->info_buffer= my_malloc(MYSQL_ERRMSG_SIZE, MYF(0));
|
||||
mysql->info_buffer= my_malloc(PSI_NOT_INSTRUMENTED, MYSQL_ERRMSG_SIZE, MYF(0));
|
||||
mysql->thd= create_embedded_thd(client_flag);
|
||||
|
||||
init_embedded_mysql(mysql, client_flag);
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
FALSE Ok
|
||||
*/
|
||||
|
||||
my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
|
||||
void *init_buffer, uint init_alloc,
|
||||
uint alloc_increment, myf my_flags)
|
||||
my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, PSI_memory_key psi_key,
|
||||
uint element_size, void *init_buffer,
|
||||
uint init_alloc, uint alloc_increment, myf my_flags)
|
||||
{
|
||||
DBUG_ENTER("init_dynamic_array2");
|
||||
if (!alloc_increment)
|
||||
|
@ -55,6 +55,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
|
|||
array->max_element=init_alloc;
|
||||
array->alloc_increment=alloc_increment;
|
||||
array->size_of_element=element_size;
|
||||
array->m_psi_key= psi_key;
|
||||
array->malloc_flags= my_flags;
|
||||
DBUG_ASSERT((my_flags & MY_INIT_BUFFER_USED) == 0);
|
||||
if ((array->buffer= init_buffer))
|
||||
|
@ -67,7 +68,7 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
|
|||
should not throw an error
|
||||
*/
|
||||
if (init_alloc &&
|
||||
!(array->buffer= (uchar*) my_malloc(element_size*init_alloc,
|
||||
!(array->buffer= (uchar*) my_malloc(psi_key, element_size*init_alloc,
|
||||
MYF(my_flags))))
|
||||
array->max_element=0;
|
||||
DBUG_RETURN(FALSE);
|
||||
|
@ -133,7 +134,8 @@ void *alloc_dynamic(DYNAMIC_ARRAY *array)
|
|||
In this scenario, the buffer is statically preallocated,
|
||||
so we have to create an all-new malloc since we overflowed
|
||||
*/
|
||||
if (!(new_ptr= (char *) my_malloc((array->max_element+
|
||||
if (!(new_ptr= (char *) my_malloc(array->m_psi_key,
|
||||
(array->max_element+
|
||||
array->alloc_increment) *
|
||||
array->size_of_element,
|
||||
MYF(array->malloc_flags | MY_WME))))
|
||||
|
@ -143,8 +145,8 @@ void *alloc_dynamic(DYNAMIC_ARRAY *array)
|
|||
array->malloc_flags&= ~MY_INIT_BUFFER_USED;
|
||||
}
|
||||
else if (!(new_ptr=(char*)
|
||||
my_realloc(array->buffer,(array->max_element+
|
||||
array->alloc_increment)*
|
||||
my_realloc(array->m_psi_key, array->buffer,
|
||||
(array->max_element+ array->alloc_increment) *
|
||||
array->size_of_element,
|
||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR |
|
||||
array->malloc_flags))))
|
||||
|
@ -241,7 +243,7 @@ my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements)
|
|||
In this senerio, the buffer is statically preallocated,
|
||||
so we have to create an all-new malloc since we overflowed
|
||||
*/
|
||||
if (!(new_ptr= (uchar *) my_malloc(size *
|
||||
if (!(new_ptr= (uchar *) my_malloc(array->m_psi_key, size *
|
||||
array->size_of_element,
|
||||
MYF(array->malloc_flags | MY_WME))))
|
||||
DBUG_RETURN(0);
|
||||
|
@ -249,7 +251,8 @@ my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements)
|
|||
array->elements * array->size_of_element);
|
||||
array->malloc_flags&= ~MY_INIT_BUFFER_USED;
|
||||
}
|
||||
else if (!(new_ptr= (uchar*) my_realloc(array->buffer,size*
|
||||
else if (!(new_ptr= (uchar*) my_realloc(array->m_psi_key,
|
||||
array->buffer,size *
|
||||
array->size_of_element,
|
||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR |
|
||||
array->malloc_flags))))
|
||||
|
@ -362,8 +365,8 @@ void freeze_size(DYNAMIC_ARRAY *array)
|
|||
elements= MY_MAX(array->elements, 1);
|
||||
if (array->buffer && array->max_element > elements)
|
||||
{
|
||||
array->buffer=(uchar*) my_realloc(array->buffer,
|
||||
elements*array->size_of_element,
|
||||
array->buffer=(uchar*) my_realloc(array->m_psi_key, array->buffer,
|
||||
elements * array->size_of_element,
|
||||
MYF(MY_WME | array->malloc_flags));
|
||||
array->max_element= elements;
|
||||
}
|
||||
|
|
|
@ -463,12 +463,12 @@ my_once_alloc_c(size_t size)
|
|||
|
||||
static void *
|
||||
my_malloc_c(size_t size)
|
||||
{ return my_malloc(size, MYF(MY_WME)); }
|
||||
{ return my_malloc(key_memory_charset_loader, size, MYF(MY_WME)); }
|
||||
|
||||
|
||||
static void *
|
||||
my_realloc_c(void *old, size_t size)
|
||||
{ return my_realloc(old, size, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); }
|
||||
{ return my_realloc(key_memory_charset_loader, old, size, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -506,7 +506,7 @@ my_read_charset_file(MY_CHARSET_LOADER *loader,
|
|||
|
||||
if (!my_stat(filename, &stat_info, MYF(myflags)) ||
|
||||
((len= (uint)stat_info.st_size) > MY_MAX_ALLOWED_BUF) ||
|
||||
!(buf= (uchar*) my_malloc(len,myflags)))
|
||||
!(buf= (uchar*) my_malloc(key_memory_charset_loader,len,myflags)))
|
||||
return TRUE;
|
||||
|
||||
if ((fd= mysql_file_open(key_file_charset, filename, O_RDONLY, myflags)) < 0)
|
||||
|
|
|
@ -84,7 +84,8 @@ LOGGER_HANDLE *logger_open(const char *path,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!(l_perm= (LOGGER_HANDLE *) my_malloc(sizeof(LOGGER_HANDLE), MYF(0))))
|
||||
if (!(l_perm= (LOGGER_HANDLE *) my_malloc(PSI_INSTRUMENT_ME,
|
||||
sizeof(LOGGER_HANDLE), MYF(0))))
|
||||
{
|
||||
my_close(new_log.file, MYF(0));
|
||||
new_log.file= -1;
|
||||
|
|
|
@ -90,7 +90,7 @@ char *get_tty_password(const char *opt_message)
|
|||
pos--; /* Allow dummy space at end */
|
||||
*pos=0;
|
||||
_cputs("\n");
|
||||
DBUG_RETURN(my_strdup(to,MYF(MY_FAE)));
|
||||
DBUG_RETURN(my_strdup(PSI_INSTRUMENT_ME, to,MYF(MY_FAE)));
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -201,7 +201,7 @@ char *get_tty_password(const char *opt_message)
|
|||
fputc('\n',stderr);
|
||||
#endif /* HAVE_GETPASS */
|
||||
|
||||
DBUG_RETURN(my_strdup(buff,MYF(MY_FAE)));
|
||||
DBUG_RETURN(my_strdup(PSI_INSTRUMENT_ME, buff, MYF(MY_FAE)));
|
||||
}
|
||||
|
||||
#endif /*__WIN__*/
|
||||
|
|
|
@ -80,7 +80,7 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
|
|||
ulong size, size_t key_offset, size_t key_length,
|
||||
my_hash_get_key get_key,
|
||||
my_hash_function hash_function,
|
||||
void (*free_element)(void*), uint flags)
|
||||
void (*free_element)(void*), uint flags, PSI_memory_key psi_key)
|
||||
{
|
||||
my_bool res;
|
||||
DBUG_ENTER("my_hash_init2");
|
||||
|
@ -95,7 +95,7 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
|
|||
hash->free=free_element;
|
||||
hash->flags=flags;
|
||||
hash->charset=charset;
|
||||
res= init_dynamic_array2(&hash->array, sizeof(HASH_LINK), NULL, size,
|
||||
res= init_dynamic_array2(&hash->array, psi_key, sizeof(HASH_LINK), NULL, size,
|
||||
growth_size, MYF((flags & HASH_THREAD_SPECIFIC ?
|
||||
MY_THREAD_SPECIFIC : 0)));
|
||||
DBUG_RETURN(res);
|
||||
|
@ -890,7 +890,8 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
|||
|
||||
printf("my_hash_init\n");
|
||||
if (my_hash_init2(&hash_test, 100, &my_charset_bin, 20,
|
||||
0, 0, (my_hash_get_key) test_get_key, 0, 0, HASH_UNIQUE))
|
||||
0, 0, (my_hash_get_key) test_get_key, 0, 0, HASH_UNIQUE,
|
||||
PSI_INSTRUMENT_ME))
|
||||
{
|
||||
fprintf(stderr, "hash init failed\n");
|
||||
exit(1);
|
||||
|
|
|
@ -99,8 +99,7 @@
|
|||
between THD's (LF_PINS::stack_ends_here being a primary reason
|
||||
for this limitation).
|
||||
*/
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#include "mysys_priv.h"
|
||||
#include <lf.h>
|
||||
|
||||
/*
|
||||
|
@ -500,7 +499,8 @@ void *lf_alloc_new(LF_PINS *pins)
|
|||
} while (node != allocator->top && LF_BACKOFF());
|
||||
if (!node)
|
||||
{
|
||||
node= (void *)my_malloc(allocator->element_size, MYF(MY_WME));
|
||||
node= (void *)my_malloc(key_memory_lf_node, allocator->element_size,
|
||||
MYF(MY_WME));
|
||||
if (allocator->constructor)
|
||||
allocator->constructor(node);
|
||||
#ifdef MY_LF_EXTRA_DEBUG
|
||||
|
|
|
@ -35,9 +35,8 @@
|
|||
Actually, it's wait-free, not lock-free ;-)
|
||||
*/
|
||||
|
||||
#include <my_global.h>
|
||||
#include "mysys_priv.h"
|
||||
#include <m_string.h>
|
||||
#include <my_sys.h>
|
||||
#include <lf.h>
|
||||
|
||||
void lf_dynarray_init(LF_DYNARRAY *array, uint element_size)
|
||||
|
@ -106,8 +105,8 @@ void *lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx)
|
|||
{
|
||||
if (!(ptr= *ptr_ptr))
|
||||
{
|
||||
void *alloc= my_malloc(LF_DYNARRAY_LEVEL_LENGTH * sizeof(void *),
|
||||
MYF(MY_WME|MY_ZEROFILL));
|
||||
void *alloc= my_malloc(key_memory_lf_dynarray, LF_DYNARRAY_LEVEL_LENGTH *
|
||||
sizeof(void *), MYF(MY_WME|MY_ZEROFILL));
|
||||
if (unlikely(!alloc))
|
||||
return(NULL);
|
||||
if (my_atomic_casptr(ptr_ptr, &ptr, alloc))
|
||||
|
@ -121,9 +120,10 @@ void *lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx)
|
|||
if (!(ptr= *ptr_ptr))
|
||||
{
|
||||
uchar *alloc, *data;
|
||||
alloc= my_malloc(LF_DYNARRAY_LEVEL_LENGTH * array->size_of_element +
|
||||
MY_MAX(array->size_of_element, sizeof(void *)),
|
||||
MYF(MY_WME|MY_ZEROFILL));
|
||||
alloc= my_malloc(key_memory_lf_dynarray,
|
||||
LF_DYNARRAY_LEVEL_LENGTH * array->size_of_element +
|
||||
MY_MAX(array->size_of_element, sizeof(void *)),
|
||||
MYF(MY_WME|MY_ZEROFILL));
|
||||
if (unlikely(!alloc))
|
||||
return(NULL);
|
||||
/* reserve the space for free() address */
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
for non-unique hash, count only _distinct_ values
|
||||
(but how to do it in lf_hash_delete ?)
|
||||
*/
|
||||
#include <my_global.h>
|
||||
#include "mysys_priv.h"
|
||||
#include <m_string.h>
|
||||
#include <my_sys.h>
|
||||
#include <mysys_err.h>
|
||||
#include <my_bit.h>
|
||||
#include <lf.h>
|
||||
|
@ -543,7 +542,8 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
|
|||
uint bucket, LF_PINS *pins)
|
||||
{
|
||||
uint parent= my_clear_highest_bit(bucket);
|
||||
LF_SLIST *dummy= (LF_SLIST *)my_malloc(sizeof(LF_SLIST), MYF(MY_WME));
|
||||
LF_SLIST *dummy= (LF_SLIST *)my_malloc(key_memory_lf_slist,
|
||||
sizeof(LF_SLIST), MYF(MY_WME));
|
||||
LF_SLIST **tmp= 0, *cur;
|
||||
LF_SLIST * volatile *el= lf_dynarray_lvalue(&hash->array, parent);
|
||||
if (unlikely(!el || !dummy))
|
||||
|
|
|
@ -70,7 +70,7 @@ void list_free(LIST *root, uint free_data)
|
|||
|
||||
LIST *list_cons(void *data, LIST *list)
|
||||
{
|
||||
LIST *new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
|
||||
LIST *new_charset=(LIST*) my_malloc(key_memory_LIST, sizeof(LIST),MYF(MY_FAE));
|
||||
if (!new_charset)
|
||||
return 0;
|
||||
new_charset->data=data;
|
||||
|
|
|
@ -2417,8 +2417,8 @@ dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint)
|
|||
str->length)
|
||||
return ER_DYNCOL_FORMAT;
|
||||
|
||||
if (my_init_dynamic_array(array_of_uint, sizeof(uint), header.column_count,
|
||||
0, MYF(0)))
|
||||
if (my_init_dynamic_array(array_of_uint, PSI_INSTRUMENT_ME,
|
||||
sizeof(uint), header.column_count, 0, MYF(0)))
|
||||
return ER_DYNCOL_RESOURCE;
|
||||
|
||||
for (i= 0, read= header.header;
|
||||
|
@ -2463,7 +2463,7 @@ mariadb_dyncol_list_num(DYNAMIC_COLUMN *str, uint *count, uint **nums)
|
|||
str->length)
|
||||
return ER_DYNCOL_FORMAT;
|
||||
|
||||
if (!((*nums)= my_malloc(sizeof(uint) * header.column_count, MYF(0))))
|
||||
if (!((*nums)= my_malloc(PSI_INSTRUMENT_ME, sizeof(uint) * header.column_count, MYF(0))))
|
||||
return ER_DYNCOL_RESOURCE;
|
||||
|
||||
for (i= 0, read= header.header;
|
||||
|
@ -2510,12 +2510,17 @@ mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, LEX_STRING **names)
|
|||
str->length)
|
||||
return ER_DYNCOL_FORMAT;
|
||||
|
||||
if (header.format == dyncol_fmt_num)
|
||||
*names= my_malloc(sizeof(LEX_STRING) * header.column_count +
|
||||
DYNCOL_NUM_CHAR * header.column_count, MYF(0));
|
||||
else
|
||||
*names= my_malloc(sizeof(LEX_STRING) * header.column_count +
|
||||
header.nmpool_size + header.column_count, MYF(0));
|
||||
{
|
||||
size_t size;
|
||||
if (header.format == dyncol_fmt_num)
|
||||
size= DYNCOL_NUM_CHAR * header.column_count;
|
||||
else
|
||||
size= header.nmpool_size + header.column_count;
|
||||
|
||||
*names= my_malloc(PSI_INSTRUMENT_ME,
|
||||
sizeof(LEX_STRING) * header.column_count + size, MYF(0));
|
||||
}
|
||||
|
||||
if (!(*names))
|
||||
return ER_DYNCOL_RESOURCE;
|
||||
pool= ((char *)(*names)) + sizeof(LEX_STRING) * header.column_count;
|
||||
|
@ -3327,7 +3332,8 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str,
|
|||
if (IN_PLACE_PLAN > add_column_count)
|
||||
plan= in_place_plan;
|
||||
else if (!(alloc_plan= plan=
|
||||
my_malloc(sizeof(PLAN) * (add_column_count + 1), MYF(0))))
|
||||
my_malloc(PSI_INSTRUMENT_ME,
|
||||
sizeof(PLAN) * (add_column_count + 1), MYF(0))))
|
||||
return ER_DYNCOL_RESOURCE;
|
||||
|
||||
not_null= add_column_count;
|
||||
|
@ -3923,7 +3929,7 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
|
|||
&dummy_errors);
|
||||
return ER_DYNCOL_OK;
|
||||
}
|
||||
if ((alloc= (char *)my_malloc(bufflen, MYF(0))))
|
||||
if ((alloc= (char *)my_malloc(PSI_INSTRUMENT_ME, bufflen, MYF(0))))
|
||||
{
|
||||
len= my_convert(alloc, bufflen, cs, from, (uint32)len,
|
||||
val->x.string.charset, &dummy_errors);
|
||||
|
@ -4298,16 +4304,19 @@ mariadb_dyncol_unpack(DYNAMIC_COLUMN *str,
|
|||
str->length)
|
||||
return ER_DYNCOL_FORMAT;
|
||||
|
||||
*vals= my_malloc(sizeof(DYNAMIC_COLUMN_VALUE)* header.column_count, MYF(0));
|
||||
*vals= my_malloc(PSI_INSTRUMENT_ME,
|
||||
sizeof(DYNAMIC_COLUMN_VALUE)* header.column_count, MYF(0));
|
||||
if (header.format == dyncol_fmt_num)
|
||||
{
|
||||
*names= my_malloc(sizeof(LEX_STRING) * header.column_count +
|
||||
*names= my_malloc(PSI_INSTRUMENT_ME,
|
||||
sizeof(LEX_STRING) * header.column_count +
|
||||
DYNCOL_NUM_CHAR * header.column_count, MYF(0));
|
||||
nm= (char *)((*names) + header.column_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
*names= my_malloc(sizeof(LEX_STRING) * header.column_count, MYF(0));
|
||||
*names= my_malloc(PSI_INSTRUMENT_ME,
|
||||
sizeof(LEX_STRING) * header.column_count, MYF(0));
|
||||
nm= 0;
|
||||
}
|
||||
if (!(*vals) || !(*names))
|
||||
|
|
|
@ -244,7 +244,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
|
|||
if (cachesize == min_cache)
|
||||
flags|= (myf) MY_WME;
|
||||
|
||||
if ((info->buffer= (uchar*) my_malloc(buffer_block, flags)) != 0)
|
||||
if ((info->buffer= (uchar*) my_malloc(key_memory_IO_CACHE, buffer_block, flags)) != 0)
|
||||
{
|
||||
if (type == SEQ_READ_APPEND)
|
||||
info->write_buffer= info->buffer + cachesize;
|
||||
|
@ -324,7 +324,7 @@ int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave)
|
|||
DBUG_ASSERT(!master->share);
|
||||
DBUG_ASSERT(master->alloced_buffer);
|
||||
|
||||
if (!(slave_buf= (uchar*)my_malloc(master->buffer_length, MYF(0))))
|
||||
if (!(slave_buf= (uchar*)my_malloc(PSI_INSTRUMENT_ME, master->buffer_length, MYF(0))))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -554,7 +554,7 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
|
|||
Allocate memory for blocks, hash_links and hash entries;
|
||||
For each block 2 hash links are allocated
|
||||
*/
|
||||
if (my_multi_malloc_large(MYF(MY_ZEROFILL),
|
||||
if (my_multi_malloc_large(key_memory_KEY_CACHE, MYF(MY_ZEROFILL),
|
||||
&keycache->block_root,
|
||||
(ulonglong) (blocks * sizeof(BLOCK_LINK)),
|
||||
&keycache->hash_root,
|
||||
|
@ -3949,8 +3949,8 @@ static int flush_key_blocks_int(SIMPLE_KEY_CACHE_CB *keycache,
|
|||
changed blocks appear while we need to wait for something.
|
||||
*/
|
||||
if ((count > FLUSH_CACHE) &&
|
||||
!(cache= (BLOCK_LINK**) my_malloc(sizeof(BLOCK_LINK*)*count,
|
||||
MYF(0))))
|
||||
!(cache= (BLOCK_LINK**) my_malloc(key_memory_KEY_CACHE,
|
||||
sizeof(BLOCK_LINK*)*count, MYF(0))))
|
||||
cache= cache_buff;
|
||||
/*
|
||||
After a restart there could be more changed blocks than now.
|
||||
|
@ -5113,7 +5113,8 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
else
|
||||
{
|
||||
if(!(partition_ptr=
|
||||
(SIMPLE_KEY_CACHE_CB **) my_malloc(sizeof(SIMPLE_KEY_CACHE_CB *) *
|
||||
(SIMPLE_KEY_CACHE_CB **) my_malloc(key_memory_KEY_CACHE,
|
||||
sizeof(SIMPLE_KEY_CACHE_CB *) *
|
||||
partitions, MYF(MY_WME))))
|
||||
DBUG_RETURN(-1);
|
||||
bzero(partition_ptr, sizeof(SIMPLE_KEY_CACHE_CB *) * partitions);
|
||||
|
@ -5131,7 +5132,8 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
else
|
||||
{
|
||||
if (!(partition=
|
||||
(SIMPLE_KEY_CACHE_CB *) my_malloc(sizeof(SIMPLE_KEY_CACHE_CB),
|
||||
(SIMPLE_KEY_CACHE_CB *) my_malloc(key_memory_KEY_CACHE,
|
||||
sizeof(SIMPLE_KEY_CACHE_CB),
|
||||
MYF(MY_WME))))
|
||||
continue;
|
||||
partition->key_cache_inited= 0;
|
||||
|
@ -5909,7 +5911,8 @@ int init_key_cache_internal(KEY_CACHE *keycache, uint key_cache_block_size,
|
|||
{
|
||||
if (partitions == 0)
|
||||
{
|
||||
if (!(keycache_cb= (void *) my_malloc(sizeof(SIMPLE_KEY_CACHE_CB),
|
||||
if (!(keycache_cb= (void *) my_malloc(key_memory_KEY_CACHE,
|
||||
sizeof(SIMPLE_KEY_CACHE_CB),
|
||||
MYF(0))))
|
||||
return 0;
|
||||
((SIMPLE_KEY_CACHE_CB *) keycache_cb)->key_cache_inited= 0;
|
||||
|
@ -5918,7 +5921,8 @@ int init_key_cache_internal(KEY_CACHE *keycache, uint key_cache_block_size,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!(keycache_cb= (void *) my_malloc(sizeof(PARTITIONED_KEY_CACHE_CB),
|
||||
if (!(keycache_cb= (void *) my_malloc(key_memory_KEY_CACHE,
|
||||
sizeof(PARTITIONED_KEY_CACHE_CB),
|
||||
MYF(0))))
|
||||
return 0;
|
||||
((PARTITIONED_KEY_CACHE_CB *) keycache_cb)->key_cache_inited= 0;
|
||||
|
|
|
@ -24,7 +24,8 @@ void my_string_ptr_sort(uchar *base, uint items, size_t size)
|
|||
uchar **ptr=0;
|
||||
|
||||
if (radixsort_is_appliccable(items, size) &&
|
||||
(ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0))))
|
||||
(ptr= (uchar**) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
items * sizeof(char*),MYF(0))))
|
||||
{
|
||||
radixsort_for_str_ptr((uchar**) base,items,size,ptr);
|
||||
my_free(ptr);
|
||||
|
|
|
@ -30,7 +30,8 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
|
|||
DBUG_PRINT("enter", ("pathlist: %s", pathlist ? pathlist : "NULL"));
|
||||
|
||||
mysql_mutex_init(key_TMPDIR_mutex, &tmpdir->mutex, MY_MUTEX_INIT_FAST);
|
||||
if (my_init_dynamic_array(&tmpdir->full_list, sizeof(char*), 1, 5, MYF(0)))
|
||||
if (my_init_dynamic_array(&tmpdir->full_list, key_memory_MY_TMPDIR_full_list,
|
||||
sizeof(char*), 1, 5, MYF(0)))
|
||||
goto err;
|
||||
if (!pathlist || !pathlist[0])
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
|
|||
end=strcend(pathlist, DELIM);
|
||||
strmake(buff, pathlist, (uint) (end-pathlist));
|
||||
length= cleanup_dirname(buff, buff);
|
||||
if (!(copy= my_strndup(buff, length, MYF(MY_WME))) ||
|
||||
if (!(copy= my_strndup(key_memory_MY_TMPDIR_full_list, buff, length, MYF(MY_WME))) ||
|
||||
insert_dynamic(&tmpdir->full_list, (uchar*) ©))
|
||||
DBUG_RETURN(TRUE);
|
||||
pathlist=end+1;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
NULL
|
||||
*/
|
||||
|
||||
void* my_multi_malloc(myf myFlags, ...)
|
||||
void* my_multi_malloc(PSI_memory_key key, myf myFlags, ...)
|
||||
{
|
||||
va_list args;
|
||||
char **ptr,*start,*res;
|
||||
|
@ -48,7 +48,7 @@ void* my_multi_malloc(myf myFlags, ...)
|
|||
}
|
||||
va_end(args);
|
||||
|
||||
if (!(start=(char *) my_malloc(tot_length,myFlags)))
|
||||
if (!(start=(char *) my_malloc(key, tot_length,myFlags)))
|
||||
DBUG_RETURN(0); /* purecov: inspected */
|
||||
|
||||
va_start(args,myFlags);
|
||||
|
@ -76,7 +76,7 @@ void* my_multi_malloc(myf myFlags, ...)
|
|||
NULL
|
||||
*/
|
||||
|
||||
void *my_multi_malloc_large(myf myFlags, ...)
|
||||
void *my_multi_malloc_large(PSI_memory_key key, myf myFlags, ...)
|
||||
{
|
||||
va_list args;
|
||||
char **ptr,*start,*res;
|
||||
|
@ -92,7 +92,7 @@ void *my_multi_malloc_large(myf myFlags, ...)
|
|||
}
|
||||
va_end(args);
|
||||
|
||||
if (!(start=(char *) my_malloc((size_t) tot_length, myFlags)))
|
||||
if (!(start=(char *) my_malloc(key, (size_t) tot_length, myFlags)))
|
||||
DBUG_RETURN(0); /* purecov: inspected */
|
||||
|
||||
va_start(args,myFlags);
|
||||
|
|
|
@ -54,35 +54,32 @@
|
|||
Because of this, we store in MY_THREAD_SPECIFIC as bit 1 in block_size
|
||||
*/
|
||||
|
||||
void init_alloc_root(MEM_ROOT *mem_root, const char *name, size_t block_size,
|
||||
void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size,
|
||||
size_t pre_alloc_size __attribute__((unused)),
|
||||
myf my_flags)
|
||||
{
|
||||
DBUG_ENTER("init_alloc_root");
|
||||
DBUG_PRINT("enter",("root: %p name: %s prealloc: %zu", mem_root,
|
||||
name, pre_alloc_size));
|
||||
DBUG_PRINT("enter",("root: %p prealloc: %zu", mem_root, pre_alloc_size));
|
||||
|
||||
mem_root->free= mem_root->used= mem_root->pre_alloc= 0;
|
||||
mem_root->min_malloc= 32;
|
||||
mem_root->block_size= (block_size - ALLOC_ROOT_MIN_BLOCK_SIZE) & ~1;
|
||||
if (MY_TEST(my_flags & MY_THREAD_SPECIFIC))
|
||||
if (my_flags & MY_THREAD_SPECIFIC)
|
||||
mem_root->block_size|= 1;
|
||||
|
||||
mem_root->error_handler= 0;
|
||||
mem_root->block_num= 4; /* We shift this with >>2 */
|
||||
mem_root->first_block_usage= 0;
|
||||
mem_root->total_alloc= 0;
|
||||
mem_root->name= name;
|
||||
mem_root->m_psi_key= key;
|
||||
|
||||
#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
|
||||
if (pre_alloc_size)
|
||||
{
|
||||
size_t size= pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM));
|
||||
if ((mem_root->free= mem_root->pre_alloc=
|
||||
(USED_MEM*) my_malloc(pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM)),
|
||||
MYF(my_flags))))
|
||||
(USED_MEM*) my_malloc(key, size, MYF(my_flags))))
|
||||
{
|
||||
mem_root->free->size= pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM));
|
||||
mem_root->total_alloc= pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM));
|
||||
mem_root->free->size= size;
|
||||
mem_root->free->left= pre_alloc_size;
|
||||
mem_root->free->next= 0;
|
||||
TRASH_MEM(mem_root->free);
|
||||
|
@ -141,19 +138,17 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
|
|||
{
|
||||
/* remove block from the list and free it */
|
||||
*prev= mem->next;
|
||||
mem_root->total_alloc-= mem->size;
|
||||
my_free(mem);
|
||||
}
|
||||
else
|
||||
prev= &mem->next;
|
||||
}
|
||||
/* Allocate new prealloc block and add it to the end of free list */
|
||||
if ((mem= (USED_MEM *) my_malloc(size,
|
||||
if ((mem= (USED_MEM *) my_malloc(mem_root->m_psi_key, size,
|
||||
MYF(MALLOC_FLAG(mem_root->
|
||||
block_size)))))
|
||||
{
|
||||
mem->size= size;
|
||||
mem_root->total_alloc+= size;
|
||||
mem->left= pre_alloc_size;
|
||||
mem->next= *prev;
|
||||
*prev= mem_root->pre_alloc= mem;
|
||||
|
@ -178,7 +173,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
|
|||
#if defined(HAVE_valgrind) && defined(EXTRA_DEBUG)
|
||||
reg1 USED_MEM *next;
|
||||
DBUG_ENTER("alloc_root");
|
||||
DBUG_PRINT("enter",("root: %p name: %s", mem_root, mem_root->name));
|
||||
DBUG_PRINT("enter",("root: %p name: %s", mem_root, root_name(mem_root)));
|
||||
|
||||
DBUG_ASSERT(alloc_root_inited(mem_root));
|
||||
|
||||
|
@ -203,10 +198,8 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
|
|||
next->left= 0;
|
||||
next->size= length;
|
||||
mem_root->used= next;
|
||||
mem_root->total_alloc+= length;
|
||||
DBUG_PRINT("exit",("ptr: %p", (((char*) next)+
|
||||
ALIGN_SIZE(sizeof(USED_MEM)))));
|
||||
DBUG_RETURN((uchar*) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
|
||||
DBUG_PRINT("exit",("ptr: %p", (((char*)next)+ALIGN_SIZE(sizeof(USED_MEM)))));
|
||||
DBUG_RETURN((((uchar*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
|
||||
#else
|
||||
size_t get_size, block_size;
|
||||
uchar* point;
|
||||
|
@ -214,7 +207,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
|
|||
reg2 USED_MEM **prev;
|
||||
size_t original_length = length;
|
||||
DBUG_ENTER("alloc_root");
|
||||
DBUG_PRINT("enter",("root: %p name: %s", mem_root, mem_root->name));
|
||||
DBUG_PRINT("enter",("root: %p name: %s", mem_root, root_name(mem_root)));
|
||||
DBUG_ASSERT(alloc_root_inited(mem_root));
|
||||
|
||||
DBUG_EXECUTE_IF("simulate_out_of_memory",
|
||||
|
@ -247,7 +240,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
|
|||
get_size= length+ALIGN_SIZE(sizeof(USED_MEM));
|
||||
get_size= MY_MAX(get_size, block_size);
|
||||
|
||||
if (!(next = (USED_MEM*) my_malloc(get_size,
|
||||
if (!(next = (USED_MEM*) my_malloc(mem_root->m_psi_key, get_size,
|
||||
MYF(MY_WME | ME_FATAL |
|
||||
MALLOC_FLAG(mem_root->
|
||||
block_size)))))
|
||||
|
@ -257,7 +250,6 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
|
|||
DBUG_RETURN((void*) 0); /* purecov: inspected */
|
||||
}
|
||||
mem_root->block_num++;
|
||||
mem_root->total_alloc+= get_size;
|
||||
next->next= *prev;
|
||||
next->size= get_size;
|
||||
next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
|
||||
|
@ -394,7 +386,7 @@ void free_root(MEM_ROOT *root, myf MyFlags)
|
|||
{
|
||||
reg1 USED_MEM *next,*old;
|
||||
DBUG_ENTER("free_root");
|
||||
DBUG_PRINT("enter",("root: %p name: %s flags: %u", root, root->name,
|
||||
DBUG_PRINT("enter",("root: %p name: %s flags: %u", root, root_name(root),
|
||||
(uint) MyFlags));
|
||||
|
||||
#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
|
||||
|
@ -415,19 +407,13 @@ void free_root(MEM_ROOT *root, myf MyFlags)
|
|||
{
|
||||
old=next; next= next->next ;
|
||||
if (old != root->pre_alloc)
|
||||
{
|
||||
root->total_alloc-= old->size;
|
||||
my_free(old);
|
||||
}
|
||||
}
|
||||
for (next=root->free ; next ;)
|
||||
{
|
||||
old=next; next= next->next;
|
||||
if (old != root->pre_alloc)
|
||||
{
|
||||
root->total_alloc-= old->size;
|
||||
my_free(old);
|
||||
}
|
||||
}
|
||||
root->used=root->free=0;
|
||||
if (root->pre_alloc)
|
||||
|
|
|
@ -173,7 +173,8 @@ my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
|
|||
size_in_bytes= ALIGN_SIZE(size_in_bytes);
|
||||
extra= sizeof(mysql_mutex_t);
|
||||
}
|
||||
if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME))))
|
||||
if (!(buf= (my_bitmap_map*) my_malloc(key_memory_MY_BITMAP_bitmap,
|
||||
size_in_bytes+extra, MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
if (thread_safe)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
/* Written by Sinisa Milivojevic <sinisa@mysql.com> */
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysys_priv.h>
|
||||
#ifdef HAVE_COMPRESS
|
||||
#include <my_sys.h>
|
||||
#ifndef SCO
|
||||
|
@ -84,7 +84,8 @@ my_bool my_compress(uchar *packet, size_t *len, size_t *complen)
|
|||
void *my_az_allocator(void *dummy __attribute__((unused)), unsigned int items,
|
||||
unsigned int size)
|
||||
{
|
||||
return my_malloc((size_t)items*(size_t)size, IF_VALGRIND(MY_ZEROFILL, MYF(0)));
|
||||
return my_malloc(key_memory_my_compress_alloc, (size_t)items*(size_t)size,
|
||||
IF_VALGRIND(MY_ZEROFILL, MYF(0)));
|
||||
}
|
||||
|
||||
void my_az_free(void *dummy __attribute__((unused)), void *address)
|
||||
|
@ -133,8 +134,9 @@ uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen)
|
|||
int res;
|
||||
*complen= *len * 120 / 100 + 12;
|
||||
|
||||
if (!(compbuf= (uchar *) my_malloc(*complen, MYF(MY_WME))))
|
||||
return 0; /* Not enough memory */
|
||||
if (!(compbuf= (uchar *) my_malloc(key_memory_my_compress_alloc,
|
||||
*complen, MYF(MY_WME))))
|
||||
return 0;
|
||||
|
||||
res= my_compress_buffer(compbuf, complen, packet, *len);
|
||||
|
||||
|
@ -180,7 +182,8 @@ my_bool my_uncompress(uchar *packet, size_t len, size_t *complen)
|
|||
|
||||
if (*complen) /* If compressed */
|
||||
{
|
||||
uchar *compbuf= (uchar *) my_malloc(*complen,MYF(MY_WME));
|
||||
uchar *compbuf= (uchar *) my_malloc(key_memory_my_compress_alloc,
|
||||
*complen,MYF(MY_WME));
|
||||
int error;
|
||||
if (!compbuf)
|
||||
DBUG_RETURN(1); /* Not enough memory */
|
||||
|
|
|
@ -410,13 +410,14 @@ int my_load_defaults(const char *conf_file, const char **groups, int *argc,
|
|||
const char **dirs;
|
||||
DBUG_ENTER("my_load_defaults");
|
||||
|
||||
init_alloc_root(&alloc, "my_load_defaults", 512, 0, MYF(0));
|
||||
init_alloc_root(key_memory_defaults, &alloc, 512, 0, MYF(0));
|
||||
if ((dirs= init_default_directories(&alloc)) == NULL)
|
||||
goto err;
|
||||
|
||||
args_used= get_defaults_options(*argv);
|
||||
|
||||
if (my_init_dynamic_array(&args, sizeof(char*), 128, 64, MYF(0)))
|
||||
if (my_init_dynamic_array(&args, key_memory_defaults, sizeof(char*), 128, 64,
|
||||
MYF(0)))
|
||||
goto err;
|
||||
|
||||
insert_dynamic(&args, *argv);/* Name MUST be set, even by embedded library */
|
||||
|
@ -879,7 +880,7 @@ void my_print_default_files(const char *conf_file)
|
|||
{
|
||||
const char **dirs;
|
||||
MEM_ROOT alloc;
|
||||
init_alloc_root(&alloc, "my_print_defaults", 512, 0, MYF(0));
|
||||
init_alloc_root(key_memory_defaults, &alloc, 512, 0, MYF(0));
|
||||
|
||||
if ((dirs= init_default_directories(&alloc)) == NULL)
|
||||
{
|
||||
|
|
|
@ -224,7 +224,8 @@ int my_error_register(const char** (*get_errmsgs)(int error), uint first,
|
|||
struct my_err_head **search_meh_pp;
|
||||
|
||||
/* Allocate a new header structure. */
|
||||
if (! (meh_p= (struct my_err_head*) my_malloc(sizeof(struct my_err_head),
|
||||
if (! (meh_p= (struct my_err_head*) my_malloc(key_memory_my_err_head,
|
||||
sizeof(struct my_err_head),
|
||||
MYF(MY_WME))))
|
||||
return 1;
|
||||
meh_p->get_errmsgs= get_errmsgs;
|
||||
|
|
|
@ -102,7 +102,8 @@ uint my_set_max_open_files(uint files)
|
|||
if (files <= MY_NFILE)
|
||||
DBUG_RETURN(files);
|
||||
|
||||
if (!(tmp= (struct st_my_file_info*) my_malloc(sizeof(*tmp) * files,
|
||||
if (!(tmp= (struct st_my_file_info*) my_malloc(key_memory_my_file_info,
|
||||
sizeof(*tmp) * files,
|
||||
MYF(MY_WME))))
|
||||
DBUG_RETURN(MY_NFILE);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags)
|
|||
statistic_increment(my_stream_opened,&THR_LOCK_open);
|
||||
DBUG_RETURN(fd); /* safeguard */
|
||||
}
|
||||
my_file_info[filedesc].name= (char*) my_strdup(filename,MyFlags);
|
||||
my_file_info[filedesc].name= my_strdup(key_memory_my_file_info, filename, MyFlags);
|
||||
statistic_increment(my_stream_opened, &THR_LOCK_open);
|
||||
statistic_increment(my_file_total_opened, &THR_LOCK_open);
|
||||
my_file_info[filedesc].type= STREAM_BY_FOPEN;
|
||||
|
@ -226,9 +226,10 @@ FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
|
|||
}
|
||||
else
|
||||
{
|
||||
my_file_info[Filedes].name= my_strdup(name,MyFlags);
|
||||
my_file_info[Filedes].name= my_strdup(key_memory_my_file_info,
|
||||
name, MyFlags);
|
||||
}
|
||||
my_file_info[Filedes].type = STREAM_BY_FDOPEN;
|
||||
my_file_info[Filedes].type= STREAM_BY_FDOPEN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysys_priv.h>
|
||||
#include <my_default.h>
|
||||
#include <m_string.h>
|
||||
#include <stdlib.h>
|
||||
#include <my_sys.h>
|
||||
#include <mysys_err.h>
|
||||
#include <my_getopt.h>
|
||||
#include <errno.h>
|
||||
|
@ -754,7 +753,8 @@ static int setval(const struct my_option *opts, void *value, char *argument,
|
|||
break;
|
||||
case GET_STR_ALLOC:
|
||||
my_free(*((char**) value));
|
||||
if (!(*((char**) value)= my_strdup(argument == enabled_my_option ? "" :
|
||||
if (!(*((char**) value)= my_strdup(key_memory_defaults,
|
||||
argument == enabled_my_option ? "" :
|
||||
argument, MYF(MY_WME))))
|
||||
{
|
||||
res= EXIT_OUT_OF_MEMORY;
|
||||
|
@ -1343,7 +1343,7 @@ static void init_one_value(const struct my_option *option, void *variable,
|
|||
{
|
||||
char **pstr= (char **) variable;
|
||||
my_free(*pstr);
|
||||
*pstr= my_strdup((char*) (intptr) value, MYF(MY_WME));
|
||||
*pstr= my_strdup(key_memory_defaults, (char*) (intptr) value, MYF(MY_WME));
|
||||
}
|
||||
break;
|
||||
default: /* dummy default to avoid compiler warnings */
|
||||
|
|
|
@ -124,16 +124,17 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||
if (!(dirp= opendir(tmp_path)))
|
||||
goto error;
|
||||
|
||||
if (!(dirh= my_malloc(sizeof(*dirh), MyFlags | MY_ZEROFILL)))
|
||||
if (!(dirh= my_malloc(key_memory_MY_DIR, sizeof(*dirh),
|
||||
MYF(MyFlags | MY_ZEROFILL))))
|
||||
goto error;
|
||||
|
||||
if (my_init_dynamic_array(&dirh->array, sizeof(FILEINFO),
|
||||
if (my_init_dynamic_array(&dirh->array, key_memory_MY_DIR, sizeof(FILEINFO),
|
||||
ENTRIES_START_SIZE, ENTRIES_INCREMENT,
|
||||
MYF(MyFlags)))
|
||||
goto error;
|
||||
|
||||
init_alloc_root(&dirh->root, "dir", NAMES_START_SIZE, NAMES_START_SIZE,
|
||||
MYF(MyFlags));
|
||||
init_alloc_root(key_memory_MY_DIR, &dirh->root, NAMES_START_SIZE,
|
||||
NAMES_START_SIZE, MYF(MyFlags));
|
||||
|
||||
dp= (struct dirent*) dirent_tmp;
|
||||
|
||||
|
@ -227,15 +228,15 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||
tmp_file[2]='*';
|
||||
tmp_file[3]='\0';
|
||||
|
||||
if (!(dirh= my_malloc(sizeof(*dirh), MyFlags | MY_ZEROFILL)))
|
||||
if (!(dirh= my_malloc(PSI_INSTRUMENT_ME, sizeof(*dirh), MyFlags | MY_ZEROFILL)))
|
||||
goto error;
|
||||
|
||||
if (my_init_dynamic_array(&dirh->array, sizeof(FILEINFO),
|
||||
if (my_init_dynamic_array(&dirh->array, PSI_INSTRUMENT_ME, sizeof(FILEINFO),
|
||||
ENTRIES_START_SIZE, ENTRIES_INCREMENT,
|
||||
MYF(MyFlags)))
|
||||
goto error;
|
||||
|
||||
init_alloc_root(&dirh->root, "dir", NAMES_START_SIZE, NAMES_START_SIZE,
|
||||
init_alloc_root(PSI_INSTRUMENT_ME, &dirh->root, NAMES_START_SIZE, NAMES_START_SIZE,
|
||||
MYF(MyFlags));
|
||||
|
||||
if ((handle=_findfirst(tmp_path,&find)) == -1L)
|
||||
|
@ -341,7 +342,8 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
|
|||
stat_area, my_flags));
|
||||
|
||||
if ((m_used= (stat_area == NULL)))
|
||||
if (!(stat_area= (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags)))
|
||||
if (!(stat_area= (MY_STAT *) my_malloc(key_memory_MY_STAT, sizeof(MY_STAT),
|
||||
my_flags)))
|
||||
goto error;
|
||||
#ifndef _WIN32
|
||||
if (! stat((char *) path, (struct stat *) stat_area) )
|
||||
|
|
|
@ -48,10 +48,9 @@ HASH likely_hash;
|
|||
void init_my_likely()
|
||||
{
|
||||
/* Allocate big enough to avoid malloc calls */
|
||||
my_hash_init2(&likely_hash, 10000, &my_charset_bin,
|
||||
1024, 0, 0,
|
||||
my_hash_init2(&likely_hash, 10000, &my_charset_bin, 1024, 0, 0,
|
||||
(my_hash_get_key) get_likely_key, 0,
|
||||
free, HASH_UNIQUE);
|
||||
free, HASH_UNIQUE, PSI_INSTRUMENT_ME);
|
||||
likely_inited= 1;
|
||||
pthread_mutex_init(&likely_mutex, MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
|
|
|
@ -19,35 +19,17 @@
|
|||
#include "mysys_err.h"
|
||||
#include <m_string.h>
|
||||
|
||||
/* If we have our own safemalloc (for debugging) */
|
||||
#if defined(SAFEMALLOC)
|
||||
#define MALLOC_SIZE_AND_FLAG(p,b) sf_malloc_usable_size(p,b)
|
||||
#define MALLOC_PREFIX_SIZE 0
|
||||
#define MALLOC_STORE_SIZE(a,b,c,d)
|
||||
#define MALLOC_FIX_POINTER_FOR_FREE(a) a
|
||||
#else
|
||||
/*
|
||||
* We use double as prefix size as this guarantees the correct
|
||||
* alignment on all platforms and will optimize things for
|
||||
* memcpy(), memcmp() etc.
|
||||
*/
|
||||
#define MALLOC_PREFIX_SIZE (sizeof(double))
|
||||
#define MALLOC_SIZE(p) (*(size_t*) ((char*)(p) - MALLOC_PREFIX_SIZE))
|
||||
#define MALLOC_STORE_SIZE(p, type_of_p, size, flag) \
|
||||
{\
|
||||
*(size_t*) p= (size) | (flag); \
|
||||
(p)= (type_of_p) (((char*) (p)) + MALLOC_PREFIX_SIZE); \
|
||||
}
|
||||
static inline size_t malloc_size_and_flag(void *p, my_bool *is_thread_specific)
|
||||
struct my_memory_header
|
||||
{
|
||||
size_t size= MALLOC_SIZE(p);
|
||||
*is_thread_specific= (size & 1);
|
||||
return size & ~ (ulonglong) 1;
|
||||
}
|
||||
#define MALLOC_SIZE_AND_FLAG(p,b) malloc_size_and_flag(p, b);
|
||||
#define MALLOC_FIX_POINTER_FOR_FREE(p) (((char*) (p)) - MALLOC_PREFIX_SIZE)
|
||||
#endif /* SAFEMALLOC */
|
||||
PSI_thread *m_owner;
|
||||
size_t m_size;
|
||||
PSI_memory_key m_key;
|
||||
};
|
||||
typedef struct my_memory_header my_memory_header;
|
||||
#define HEADER_SIZE 24
|
||||
|
||||
#define USER_TO_HEADER(P) ((my_memory_header*)((char *)(P) - HEADER_SIZE))
|
||||
#define HEADER_TO_USER(P) ((char*)(P) + HEADER_SIZE)
|
||||
|
||||
/**
|
||||
Inform application that memory usage has changed
|
||||
|
@ -82,12 +64,13 @@ void set_malloc_size_cb(MALLOC_SIZE_CB func)
|
|||
|
||||
@return A pointer to the allocated memory block, or NULL on failure.
|
||||
*/
|
||||
void *my_malloc(size_t size, myf my_flags)
|
||||
void *my_malloc(PSI_memory_key key, size_t size, myf my_flags)
|
||||
{
|
||||
void* point;
|
||||
my_memory_header *mh;
|
||||
void *point;
|
||||
DBUG_ENTER("my_malloc");
|
||||
DBUG_PRINT("my",("size: %lu my_flags: %lu", (ulong) size, my_flags));
|
||||
compile_time_assert(sizeof(size_t) <= sizeof(double));
|
||||
DBUG_PRINT("my",("size: %zu flags: %lu", size, my_flags));
|
||||
compile_time_assert(sizeof(my_memory_header) <= HEADER_SIZE);
|
||||
|
||||
if (!(my_flags & (MY_WME | MY_FAE)))
|
||||
my_flags|= my_global_flags;
|
||||
|
@ -96,11 +79,15 @@ void *my_malloc(size_t size, myf my_flags)
|
|||
if (!size)
|
||||
size=1;
|
||||
|
||||
/* We have to align size to be able to store markers in it */
|
||||
/* We have to align size as we store MY_THREAD_SPECIFIC flag in the LSB */
|
||||
size= ALIGN_SIZE(size);
|
||||
point= sf_malloc(size + MALLOC_PREFIX_SIZE, my_flags);
|
||||
|
||||
if (point == NULL)
|
||||
if (DBUG_EVALUATE_IF("simulate_out_of_memory", 1, 0))
|
||||
mh= NULL;
|
||||
else
|
||||
mh= (my_memory_header*) sf_malloc(size + HEADER_SIZE, my_flags);
|
||||
|
||||
if (mh == NULL)
|
||||
{
|
||||
my_errno=errno;
|
||||
if (my_flags & MY_FAE)
|
||||
|
@ -109,22 +96,19 @@ void *my_malloc(size_t size, myf my_flags)
|
|||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_ERROR_LOG+ME_FATAL),size);
|
||||
if (my_flags & MY_FAE)
|
||||
abort();
|
||||
point= NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
MALLOC_STORE_SIZE(point, void*, size,
|
||||
MY_TEST(my_flags & MY_THREAD_SPECIFIC));
|
||||
update_malloc_size(size + MALLOC_PREFIX_SIZE,
|
||||
MY_TEST(my_flags & MY_THREAD_SPECIFIC));
|
||||
TRASH_ALLOC(point, size);
|
||||
DBUG_EXECUTE_IF("simulate_out_of_memory",
|
||||
{
|
||||
/* my_free() handles memory accounting */
|
||||
my_free(point);
|
||||
point= NULL;
|
||||
});
|
||||
int flag= MY_TEST(my_flags & MY_THREAD_SPECIFIC);
|
||||
mh->m_size= size | flag;
|
||||
mh->m_key= PSI_CALL_memory_alloc(key, size, & mh->m_owner);
|
||||
update_malloc_size(size + HEADER_SIZE, flag);
|
||||
point= HEADER_TO_USER(mh);
|
||||
if (my_flags & MY_ZEROFILL)
|
||||
bzero(point, size);
|
||||
else
|
||||
TRASH_ALLOC(point, size);
|
||||
}
|
||||
DBUG_PRINT("exit",("ptr: %p", point));
|
||||
DBUG_RETURN(point);
|
||||
|
@ -134,62 +118,57 @@ void *my_malloc(size_t size, myf my_flags)
|
|||
/**
|
||||
@brief wrapper around realloc()
|
||||
|
||||
@param oldpoint pointer to currently allocated area
|
||||
@param old_point pointer to currently allocated area
|
||||
@param size new size requested, must be >0
|
||||
@param my_flags flags
|
||||
|
||||
@note if size==0 realloc() may return NULL; my_realloc() treats this as an
|
||||
error which is not the intention of realloc()
|
||||
*/
|
||||
void *my_realloc(void *oldpoint, size_t size, myf my_flags)
|
||||
void *my_realloc(PSI_memory_key key, void *old_point, size_t size, myf my_flags)
|
||||
{
|
||||
my_memory_header *old_mh, *mh;
|
||||
void *point;
|
||||
size_t old_size;
|
||||
my_bool old_flags;
|
||||
DBUG_ENTER("my_realloc");
|
||||
DBUG_PRINT("my",("ptr: %p size: %lu my_flags: %lu", oldpoint,
|
||||
(ulong) size, my_flags));
|
||||
DBUG_PRINT("my",("ptr: %p size: %zu flags: %lu", old_point, size, my_flags));
|
||||
|
||||
DBUG_ASSERT(size > 0);
|
||||
if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
|
||||
DBUG_RETURN(my_malloc(size, my_flags));
|
||||
if (!old_point && (my_flags & MY_ALLOW_ZERO_PTR))
|
||||
DBUG_RETURN(my_malloc(key, size, my_flags));
|
||||
|
||||
old_mh= USER_TO_HEADER(old_point);
|
||||
old_size= old_mh->m_size & ~1;
|
||||
old_flags= old_mh->m_size & 1;
|
||||
|
||||
DBUG_ASSERT(old_mh->m_key == key || old_mh->m_key == PSI_NOT_INSTRUMENTED);
|
||||
DBUG_ASSERT(old_flags == MY_TEST(my_flags & MY_THREAD_SPECIFIC));
|
||||
|
||||
size= ALIGN_SIZE(size);
|
||||
old_size= MALLOC_SIZE_AND_FLAG(oldpoint, &old_flags);
|
||||
/*
|
||||
Test that the new and old area are the same, if not MY_THREAD_MOVE is
|
||||
given
|
||||
*/
|
||||
DBUG_ASSERT((MY_TEST(my_flags & MY_THREAD_SPECIFIC) == old_flags) ||
|
||||
(my_flags & MY_THREAD_MOVE));
|
||||
if ((point= sf_realloc(MALLOC_FIX_POINTER_FOR_FREE(oldpoint),
|
||||
size + MALLOC_PREFIX_SIZE, my_flags)) == NULL)
|
||||
mh= sf_realloc(old_mh, size + HEADER_SIZE, my_flags);
|
||||
|
||||
if (mh == NULL)
|
||||
{
|
||||
if (size < old_size)
|
||||
DBUG_RETURN(old_point);
|
||||
my_errno=errno;
|
||||
if (my_flags & MY_FREE_ON_ERROR)
|
||||
{
|
||||
/* my_free will take care of size accounting */
|
||||
my_free(oldpoint);
|
||||
oldpoint= 0;
|
||||
my_free(old_point);
|
||||
old_point= 0;
|
||||
}
|
||||
if (my_flags & MY_HOLD_ON_ERROR)
|
||||
DBUG_RETURN(oldpoint);
|
||||
my_errno=errno;
|
||||
if (my_flags & (MY_FAE+MY_WME))
|
||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_FATAL), size);
|
||||
point= NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
MALLOC_STORE_SIZE(point, void*, size,
|
||||
MY_TEST(my_flags & MY_THREAD_SPECIFIC));
|
||||
if (MY_TEST(my_flags & MY_THREAD_SPECIFIC) != old_flags)
|
||||
{
|
||||
/* memory moved between system and thread specific */
|
||||
update_malloc_size(-(longlong) old_size - MALLOC_PREFIX_SIZE, old_flags);
|
||||
update_malloc_size((longlong) size + MALLOC_PREFIX_SIZE,
|
||||
MY_TEST(my_flags & MY_THREAD_SPECIFIC));
|
||||
}
|
||||
else
|
||||
update_malloc_size((longlong)size - (longlong)old_size, old_flags);
|
||||
mh->m_size= size | old_flags;
|
||||
mh->m_key= PSI_CALL_memory_realloc(key, old_size, size, & mh->m_owner);
|
||||
update_malloc_size((longlong)size - (longlong)old_size, old_flags);
|
||||
point= HEADER_TO_USER(mh);
|
||||
}
|
||||
|
||||
DBUG_PRINT("exit",("ptr: %p", point));
|
||||
|
@ -204,56 +183,63 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags)
|
|||
*/
|
||||
void my_free(void *ptr)
|
||||
{
|
||||
my_memory_header *mh;
|
||||
size_t old_size;
|
||||
my_bool old_flags;
|
||||
DBUG_ENTER("my_free");
|
||||
DBUG_PRINT("my",("ptr: %p", ptr));
|
||||
if (ptr)
|
||||
{
|
||||
size_t old_size;
|
||||
my_bool old_flags;
|
||||
old_size= MALLOC_SIZE_AND_FLAG(ptr, &old_flags);
|
||||
update_malloc_size(- (longlong) old_size - MALLOC_PREFIX_SIZE, old_flags);
|
||||
|
||||
if (ptr == NULL)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
mh= USER_TO_HEADER(ptr);
|
||||
old_size= mh->m_size & ~1;
|
||||
old_flags= mh->m_size & 1;
|
||||
PSI_CALL_memory_free(mh->m_key, old_size, mh->m_owner);
|
||||
|
||||
update_malloc_size(- (longlong) old_size - HEADER_SIZE, old_flags);
|
||||
|
||||
#ifndef SAFEMALLOC
|
||||
/*
|
||||
Trash memory if not safemalloc. We don't have to do this if safemalloc
|
||||
is used as safemalloc will also do trashing
|
||||
*/
|
||||
TRASH_FREE(ptr, old_size);
|
||||
/*
|
||||
Trash memory if not safemalloc. We don't have to do this if safemalloc
|
||||
is used as safemalloc will also do trashing
|
||||
*/
|
||||
TRASH_FREE(ptr, old_size);
|
||||
#endif
|
||||
sf_free(MALLOC_FIX_POINTER_FOR_FREE(ptr));
|
||||
}
|
||||
sf_free(mh);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void *my_memdup(const void *from, size_t length, myf my_flags)
|
||||
void *my_memdup(PSI_memory_key key, const void *from, size_t length, myf my_flags)
|
||||
{
|
||||
void *ptr;
|
||||
DBUG_ENTER("my_memdup");
|
||||
|
||||
if ((ptr= my_malloc(length,my_flags)) != 0)
|
||||
if ((ptr= my_malloc(key, length,my_flags)) != 0)
|
||||
memcpy(ptr, from, length);
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
||||
|
||||
char *my_strdup(const char *from, myf my_flags)
|
||||
char *my_strdup(PSI_memory_key key, const char *from, myf my_flags)
|
||||
{
|
||||
char *ptr;
|
||||
size_t length= strlen(from)+1;
|
||||
DBUG_ENTER("my_strdup");
|
||||
|
||||
if ((ptr= (char*) my_malloc(length, my_flags)))
|
||||
if ((ptr= (char*) my_malloc(key, length, my_flags)))
|
||||
memcpy(ptr, from, length);
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
||||
|
||||
char *my_strndup(const char *from, size_t length, myf my_flags)
|
||||
char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf my_flags)
|
||||
{
|
||||
char *ptr;
|
||||
DBUG_ENTER("my_strndup");
|
||||
|
||||
if ((ptr= (char*) my_malloc(length+1, my_flags)))
|
||||
if ((ptr= (char*) my_malloc(key, length+1, my_flags)))
|
||||
{
|
||||
memcpy(ptr, from, length);
|
||||
ptr[length]= 0;
|
||||
|
|
|
@ -136,7 +136,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
|
|||
thread_safe_increment32(&my_file_opened);
|
||||
if ((uint) fd >= my_file_limit)
|
||||
DBUG_RETURN(fd);
|
||||
my_file_info[fd].name = (char*) my_strdup(FileName, MyFlags);
|
||||
my_file_info[fd].name = my_strdup(key_memory_my_file_info, FileName, MyFlags);
|
||||
statistic_increment(my_file_total_opened,&THR_LOCK_open);
|
||||
my_file_info[fd].type = type_of_file;
|
||||
DBUG_PRINT("exit",("fd: %d",fd));
|
||||
|
|
|
@ -102,7 +102,8 @@ my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
|
|||
DBUG_ENTER("safe_hash_init");
|
||||
if (my_hash_init(&hash->hash, &my_charset_bin, elements,
|
||||
0, 0, (my_hash_get_key) safe_hash_entry_get,
|
||||
(void (*)(void*)) safe_hash_entry_free, 0))
|
||||
(void (*)(void*)) safe_hash_entry_free, 0,
|
||||
key_memory_SAFE_HASH_ENTRY))
|
||||
{
|
||||
hash->default_value= 0;
|
||||
DBUG_RETURN(1);
|
||||
|
@ -224,7 +225,8 @@ my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!(entry= (SAFE_HASH_ENTRY *) my_malloc(sizeof(*entry) + length,
|
||||
if (!(entry= (SAFE_HASH_ENTRY *) my_malloc(key_memory_SAFE_HASH_ENTRY,
|
||||
sizeof(*entry) + length,
|
||||
MYF(MY_WME))))
|
||||
{
|
||||
error= 1;
|
||||
|
|
|
@ -24,6 +24,36 @@
|
|||
#include "my_alarm.h"
|
||||
|
||||
|
||||
PSI_memory_key key_memory_DYNAMIC_STRING;
|
||||
PSI_memory_key key_memory_IO_CACHE;
|
||||
PSI_memory_key key_memory_KEY_CACHE;
|
||||
PSI_memory_key key_memory_LIST;
|
||||
PSI_memory_key key_memory_MY_BITMAP_bitmap;
|
||||
PSI_memory_key key_memory_MY_DIR;
|
||||
PSI_memory_key key_memory_MY_STAT;
|
||||
PSI_memory_key key_memory_MY_TMPDIR_full_list;
|
||||
PSI_memory_key key_memory_QUEUE;
|
||||
PSI_memory_key key_memory_SAFE_HASH_ENTRY;
|
||||
PSI_memory_key key_memory_THD_ALARM;
|
||||
PSI_memory_key key_memory_TREE;
|
||||
PSI_memory_key key_memory_charset_file;
|
||||
PSI_memory_key key_memory_charset_loader;
|
||||
PSI_memory_key key_memory_defaults;
|
||||
PSI_memory_key key_memory_lf_dynarray;
|
||||
PSI_memory_key key_memory_lf_node;
|
||||
PSI_memory_key key_memory_lf_slist;
|
||||
PSI_memory_key key_memory_max_alloca;
|
||||
PSI_memory_key key_memory_my_compress_alloc;
|
||||
PSI_memory_key key_memory_my_err_head;
|
||||
PSI_memory_key key_memory_my_file_info;
|
||||
PSI_memory_key key_memory_pack_frm;
|
||||
|
||||
#ifdef _WIN32
|
||||
PSI_memory_key key_memory_win_SECURITY_ATTRIBUTES;
|
||||
PSI_memory_key key_memory_win_PACL;
|
||||
PSI_memory_key key_memory_win_IP_ADAPTER_ADDRESSES;
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* from my_init */
|
||||
char *home_dir=0;
|
||||
char *mysql_data_home= (char*) ".";
|
||||
|
|
|
@ -96,7 +96,7 @@ int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
|
|||
}
|
||||
GetTokenInformation(htoken, TokenUser, 0, 0, &owner_token_length);
|
||||
|
||||
if (! my_multi_malloc(MYF(MY_WME),
|
||||
if (! my_multi_malloc(MYF(MY_WME), PSI_INSTRUMENT_ME,
|
||||
&sa, ALIGN_SIZE(sizeof(SECURITY_ATTRIBUTES)) +
|
||||
sizeof(My_security_attr),
|
||||
&sd, sizeof(SECURITY_DESCRIPTOR),
|
||||
|
@ -126,7 +126,7 @@ int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
|
|||
GetLengthSid(everyone_sid) + GetLengthSid(owner_sid);
|
||||
|
||||
/* Create an ACL */
|
||||
if (! (dacl= (PACL) my_malloc(dacl_length, MYF(MY_ZEROFILL|MY_WME))))
|
||||
if (! (dacl= (PACL) my_malloc(PSI_INSTRUMENT_ME, dacl_length, MYF(MY_ZEROFILL|MY_WME))))
|
||||
{
|
||||
*perror= "Failed to allocate memory for DACL";
|
||||
goto error;
|
||||
|
|
|
@ -64,6 +64,36 @@ extern PSI_rwlock_key key_SAFEHASH_mutex;
|
|||
|
||||
extern PSI_stage_info stage_waiting_for_table_level_lock;
|
||||
|
||||
/* These keys are always defined. */
|
||||
|
||||
extern PSI_memory_key key_memory_DYNAMIC_STRING;
|
||||
extern PSI_memory_key key_memory_IO_CACHE;
|
||||
extern PSI_memory_key key_memory_KEY_CACHE;
|
||||
extern PSI_memory_key key_memory_LIST;
|
||||
extern PSI_memory_key key_memory_MY_BITMAP_bitmap;
|
||||
extern PSI_memory_key key_memory_MY_DIR;
|
||||
extern PSI_memory_key key_memory_MY_STAT;
|
||||
extern PSI_memory_key key_memory_MY_TMPDIR_full_list;
|
||||
extern PSI_memory_key key_memory_QUEUE;
|
||||
extern PSI_memory_key key_memory_SAFE_HASH_ENTRY;
|
||||
extern PSI_memory_key key_memory_TREE;
|
||||
extern PSI_memory_key key_memory_charset_file;
|
||||
extern PSI_memory_key key_memory_charset_loader;
|
||||
extern PSI_memory_key key_memory_defaults;
|
||||
extern PSI_memory_key key_memory_lf_dynarray;
|
||||
extern PSI_memory_key key_memory_lf_node;
|
||||
extern PSI_memory_key key_memory_lf_slist;
|
||||
extern PSI_memory_key key_memory_my_compress_alloc;
|
||||
extern PSI_memory_key key_memory_my_err_head;
|
||||
extern PSI_memory_key key_memory_my_file_info;
|
||||
extern PSI_memory_key key_memory_pack_frm;
|
||||
|
||||
#ifdef _WIN32
|
||||
extern PSI_memory_key key_memory_win_SECURITY_ATTRIBUTES;
|
||||
extern PSI_memory_key key_memory_win_PACL;
|
||||
extern PSI_memory_key key_memory_win_IP_ADAPTER_ADDRESSES;
|
||||
#endif
|
||||
|
||||
extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
|
||||
extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_net;
|
||||
extern mysql_mutex_t THR_LOCK_charset;
|
||||
|
|
|
@ -76,7 +76,8 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
|||
|
||||
{
|
||||
DBUG_ENTER("init_queue");
|
||||
if ((queue->root= (uchar **) my_malloc((max_elements + 1) * sizeof(void*),
|
||||
if ((queue->root= (uchar **) my_malloc(key_memory_QUEUE,
|
||||
(max_elements + 1) * sizeof(void*),
|
||||
MYF(MY_WME))) == 0)
|
||||
DBUG_RETURN(1);
|
||||
queue->elements= 0;
|
||||
|
@ -148,7 +149,7 @@ int resize_queue(QUEUE *queue, uint max_elements)
|
|||
DBUG_ENTER("resize_queue");
|
||||
if (queue->max_elements == max_elements)
|
||||
DBUG_RETURN(0);
|
||||
if ((new_root= (uchar **) my_realloc((void *)queue->root,
|
||||
if ((new_root= (uchar **) my_realloc(key_memory_QUEUE, (void *)queue->root,
|
||||
(max_elements + 1)* sizeof(void*),
|
||||
MYF(MY_WME))) == 0)
|
||||
DBUG_RETURN(1);
|
||||
|
|
|
@ -36,7 +36,8 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
|
|||
if (!init_alloc)
|
||||
init_alloc=alloc_increment;
|
||||
|
||||
if (!(str->str=(char*) my_malloc(init_alloc,MYF(MY_WME))))
|
||||
if (!(str->str=(char*) my_malloc(key_memory_DYNAMIC_STRING,
|
||||
init_alloc, MYF(MY_WME))))
|
||||
DBUG_RETURN(TRUE);
|
||||
str->length=length-1;
|
||||
if (init_str)
|
||||
|
@ -58,7 +59,8 @@ my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
|
|||
str->alloc_increment;
|
||||
if (!str->max_length)
|
||||
str->max_length=str->alloc_increment;
|
||||
if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
|
||||
if (!(str->str=(char*) my_realloc(key_memory_DYNAMIC_STRING,
|
||||
str->str, str->max_length, MYF(MY_WME))))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (init_str)
|
||||
|
@ -81,7 +83,8 @@ my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size)
|
|||
{
|
||||
str->max_length=((str->length + additional_size+str->alloc_increment-1)/
|
||||
str->alloc_increment)*str->alloc_increment;
|
||||
if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
|
||||
if (!(str->str=(char*) my_realloc(key_memory_DYNAMIC_STRING, str->str,
|
||||
str->max_length, MYF(MY_WME))))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
|
@ -104,7 +107,8 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
|
|||
size_t new_length=(str->length+length+str->alloc_increment)/
|
||||
str->alloc_increment;
|
||||
new_length*=str->alloc_increment;
|
||||
if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME))))
|
||||
if (!(new_ptr=(char*) my_realloc(key_memory_DYNAMIC_STRING, str->str,
|
||||
new_length, MYF(MY_WME))))
|
||||
DBUG_RETURN(TRUE);
|
||||
str->str=new_ptr;
|
||||
str->max_length=new_length;
|
||||
|
|
|
@ -185,7 +185,8 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
|
|||
now= my_time(0);
|
||||
if (!alarm_data)
|
||||
{
|
||||
if (!(alarm_data=(ALARM*) my_malloc(sizeof(ALARM),MYF(MY_WME))))
|
||||
if (!(alarm_data=(ALARM*) my_malloc(PSI_INSTRUMENT_ME, sizeof(ALARM),
|
||||
MYF(MY_WME))))
|
||||
goto abort_no_unlock;
|
||||
alarm_data->malloced= 1;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ static inline void remove_from_active_list(safe_mutex_t *mp)
|
|||
|
||||
static int safe_mutex_lazy_init_deadlock_detection(safe_mutex_t *mp)
|
||||
{
|
||||
if (!my_multi_malloc(MY_FAE | MY_WME,
|
||||
if (!my_multi_malloc(PSI_NOT_INSTRUMENTED, MY_FAE | MY_WME,
|
||||
&mp->locked_mutex, sizeof(*mp->locked_mutex),
|
||||
&mp->used_mutex, sizeof(*mp->used_mutex), NullS))
|
||||
{
|
||||
|
@ -169,16 +169,12 @@ static int safe_mutex_lazy_init_deadlock_detection(safe_mutex_t *mp)
|
|||
pthread_mutex_lock(&THR_LOCK_mutex);
|
||||
mp->id= ++safe_mutex_id;
|
||||
pthread_mutex_unlock(&THR_LOCK_mutex);
|
||||
my_hash_init2(mp->locked_mutex, 64, &my_charset_bin,
|
||||
128,
|
||||
offsetof(safe_mutex_deadlock_t, id),
|
||||
sizeof(mp->id),
|
||||
0, 0, 0, HASH_UNIQUE);
|
||||
my_hash_init2(mp->used_mutex, 64, &my_charset_bin,
|
||||
128,
|
||||
offsetof(safe_mutex_t, id),
|
||||
sizeof(mp->id),
|
||||
0, 0, 0, HASH_UNIQUE);
|
||||
my_hash_init2(mp->locked_mutex, 64, &my_charset_bin, 128,
|
||||
offsetof(safe_mutex_deadlock_t, id), sizeof(mp->id), 0, 0, 0,
|
||||
HASH_UNIQUE, PSI_NOT_INSTRUMENTED);
|
||||
my_hash_init2(mp->used_mutex, 64, &my_charset_bin, 128,
|
||||
offsetof(safe_mutex_t, id), sizeof(mp->id), 0, 0, 0,
|
||||
HASH_UNIQUE, PSI_NOT_INSTRUMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -341,7 +337,7 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
|
|||
safe_mutex_t *mutex;
|
||||
|
||||
/* Create object to store mutex info */
|
||||
if (!(deadlock= my_malloc(sizeof(*deadlock),
|
||||
if (!(deadlock= my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*deadlock),
|
||||
MYF(MY_ZEROFILL | MY_WME | MY_FAE))))
|
||||
goto abort_loop;
|
||||
deadlock->name= mp->name;
|
||||
|
|
|
@ -128,7 +128,7 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit,
|
|||
}
|
||||
if (!(tree->with_delete= MY_TEST(my_flags & MY_TREE_WITH_DELETE)))
|
||||
{
|
||||
init_alloc_root(&tree->mem_root, "tree", default_alloc_size, 0,
|
||||
init_alloc_root(key_memory_TREE, &tree->mem_root, default_alloc_size, 0,
|
||||
MYF(my_flags));
|
||||
tree->mem_root.min_malloc= sizeof(TREE_ELEMENT)+tree->size_of_element;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size,
|
|||
|
||||
key_size+=tree->size_of_element;
|
||||
if (tree->with_delete)
|
||||
element=(TREE_ELEMENT *) my_malloc(alloc_size,
|
||||
element=(TREE_ELEMENT *) my_malloc(key_memory_TREE, alloc_size,
|
||||
MYF(tree->my_flags | MY_WME));
|
||||
else
|
||||
element=(TREE_ELEMENT *) alloc_root(&tree->mem_root,alloc_size);
|
||||
|
|
|
@ -394,7 +394,8 @@ static void wt_resource_create(uchar *arg)
|
|||
bzero(rc, sizeof(*rc));
|
||||
rc_rwlock_init(rc);
|
||||
mysql_cond_init(key_WT_RESOURCE_cond, &rc->cond, 0);
|
||||
my_init_dynamic_array(&rc->owners, sizeof(WT_THD *), 0, 5, MYF(0));
|
||||
my_init_dynamic_array(&rc->owners, PSI_INSTRUMENT_ME,
|
||||
sizeof(WT_THD *), 0, 5, MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -507,7 +508,8 @@ void wt_thd_lazy_init(WT_THD *thd, const ulong *ds, const ulong *ts,
|
|||
thd->deadlock_search_depth_long= dl;
|
||||
thd->timeout_long= tl;
|
||||
/* dynamic array is also initialized lazily - without memory allocations */
|
||||
my_init_dynamic_array(&thd->my_resources, sizeof(WT_RESOURCE *), 0, 5, MYF(0));
|
||||
my_init_dynamic_array(&thd->my_resources, PSI_INSTRUMENT_ME,
|
||||
sizeof(WT_RESOURCE *), 0, 5, MYF(0));
|
||||
#ifndef DBUG_OFF
|
||||
thd->name= my_thread_name();
|
||||
#endif
|
||||
|
|
|
@ -98,7 +98,7 @@ static int daemon_example_plugin_init(void *p __attribute__ ((unused)))
|
|||
struct st_plugin_int *plugin= (struct st_plugin_int *)p;
|
||||
|
||||
con= (struct mysql_heartbeat_context *)
|
||||
my_malloc(sizeof(struct mysql_heartbeat_context), MYF(0));
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, sizeof(struct mysql_heartbeat_context), MYF(0));
|
||||
|
||||
fn_format(heartbeat_filename, "mysql-heartbeat", "", ".log",
|
||||
MY_REPLACE_EXT | MY_UNPACK_FILENAME);
|
||||
|
|
|
@ -280,7 +280,7 @@ static int init(void *p)
|
|||
if (*s == ' ')
|
||||
url_count++;
|
||||
|
||||
urls= (Url **)my_malloc(url_count*sizeof(Url*), MYF(MY_WME));
|
||||
urls= (Url **)my_malloc(PSI_INSTRUMENT_ME, url_count*sizeof(Url*), MYF(MY_WME));
|
||||
if (!urls)
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ Url* http_create(const char *url, size_t url_length);
|
|||
*/
|
||||
Url* Url::create(const char *url, size_t url_length)
|
||||
{
|
||||
url= my_strndup(url, url_length, MYF(MY_WME));
|
||||
url= my_strndup(PSI_INSTRUMENT_ME, url, url_length, MYF(MY_WME));
|
||||
|
||||
if (!url)
|
||||
return NULL;
|
||||
|
@ -88,8 +88,8 @@ int Url::parse_proxy_server(const char *proxy_server, size_t proxy_length,
|
|||
port->length= 2;
|
||||
}
|
||||
|
||||
host->str= my_strndup(host->str, host->length, MYF(MY_WME));
|
||||
port->str= my_strndup(port->str, port->length, MYF(MY_WME));
|
||||
host->str= my_strndup(PSI_INSTRUMENT_ME, host->str, host->length, MYF(MY_WME));
|
||||
port->str= my_strndup(PSI_INSTRUMENT_ME, port->str, port->length, MYF(MY_WME));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,9 +143,9 @@ Url* http_create(const char *url, size_t url_length)
|
|||
if (!host.length || !port.length || path.str[0] != '/')
|
||||
return NULL;
|
||||
|
||||
host.str= my_strndup(host.str, host.length, MYF(MY_WME));
|
||||
port.str= my_strndup(port.str, port.length, MYF(MY_WME));
|
||||
path.str= my_strndup(path.str, path.length, MYF(MY_WME));
|
||||
host.str= my_strndup(PSI_INSTRUMENT_ME, host.str, host.length, MYF(MY_WME));
|
||||
port.str= my_strndup(PSI_INSTRUMENT_ME, port.str, port.length, MYF(MY_WME));
|
||||
path.str= my_strndup(PSI_INSTRUMENT_ME, path.str, path.length, MYF(MY_WME));
|
||||
|
||||
if (!host.str || !port.str || !path.str)
|
||||
{
|
||||
|
|
|
@ -298,7 +298,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag)
|
|||
thd->options |= OPTION_BIN_LOG;
|
||||
#endif
|
||||
safeFree((char*) thd->db.str);
|
||||
thd->db.str= my_strdup("handlersocket", MYF(0));
|
||||
thd->db.str= my_strdup(PSI_NOT_INSTRUMENTED, "handlersocket", MYF(0));
|
||||
thd->db.length= sizeof("handlersocket")-1;
|
||||
}
|
||||
thd->variables.option_bits |= OPTION_TABLE_LOCK;
|
||||
|
|
|
@ -124,7 +124,7 @@ static char *default_home= (char *)".";
|
|||
#define my_rename(A, B, C) loc_rename(A, B)
|
||||
#define my_tell(A, B) loc_tell(A)
|
||||
#define my_write(A, B, C, D) loc_write(A, B, C)
|
||||
#define my_malloc(A, B) malloc(A)
|
||||
#define my_malloc(A, B, C) malloc(B)
|
||||
#define my_free(A) free(A)
|
||||
#ifdef my_errno
|
||||
#undef my_errno
|
||||
|
|
|
@ -112,6 +112,52 @@ typedef enum {
|
|||
#define native_password_plugin_name "mysql_native_password"
|
||||
#define old_password_plugin_name "mysql_old_password"
|
||||
|
||||
PSI_memory_key key_memory_mysql_options;
|
||||
PSI_memory_key key_memory_MYSQL_DATA;
|
||||
PSI_memory_key key_memory_MYSQL;
|
||||
PSI_memory_key key_memory_MYSQL_RES;
|
||||
PSI_memory_key key_memory_MYSQL_ROW;
|
||||
PSI_memory_key key_memory_MYSQL_state_change_info;
|
||||
PSI_memory_key key_memory_MYSQL_HANDSHAKE;
|
||||
|
||||
#if defined (_WIN32) && !defined (EMBEDDED_LIBRARY)
|
||||
PSI_memory_key key_memory_create_shared_memory;
|
||||
#endif /* _WIN32 && ! EMBEDDED_LIBRARY */
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
/*
|
||||
This code is common to the client and server,
|
||||
and also used in the server when server A connects to server B,
|
||||
for example with replication.
|
||||
Therefore, the code is also instrumented.
|
||||
*/
|
||||
|
||||
static PSI_memory_info all_client_memory[]=
|
||||
{
|
||||
#if defined (_WIN32) && !defined (EMBEDDED_LIBRARY)
|
||||
{ &key_memory_create_shared_memory, "create_shared_memory", 0},
|
||||
#endif /* _WIN32 && ! EMBEDDED_LIBRARY */
|
||||
|
||||
{ &key_memory_mysql_options, "mysql_options", 0},
|
||||
{ &key_memory_MYSQL_DATA, "MYSQL_DATA", 0},
|
||||
{ &key_memory_MYSQL, "MYSQL", 0},
|
||||
{ &key_memory_MYSQL_RES, "MYSQL_RES", 0},
|
||||
{ &key_memory_MYSQL_ROW, "MYSQL_ROW", 0},
|
||||
{ &key_memory_MYSQL_state_change_info, "MYSQL_STATE_CHANGE_INFO", 0},
|
||||
{ &key_memory_MYSQL_HANDSHAKE, "MYSQL_HANDSHAKE", 0}
|
||||
};
|
||||
|
||||
void init_client_psi_keys(void)
|
||||
{
|
||||
const char *category= "client";
|
||||
int count;
|
||||
|
||||
count= array_elements(all_client_memory);
|
||||
mysql_memory_register(category, all_client_memory, count);
|
||||
}
|
||||
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
uint mariadb_deinitialize_ssl= 1;
|
||||
uint mysql_port=0;
|
||||
char *mysql_unix_port= 0;
|
||||
|
@ -491,7 +537,7 @@ void free_old_query(MYSQL *mysql)
|
|||
if (mysql->fields)
|
||||
free_root(&mysql->field_alloc,MYF(0));
|
||||
/* Assume rowlength < 8192 */
|
||||
init_alloc_root(&mysql->field_alloc, "fields", 8192, 0,
|
||||
init_alloc_root(PSI_INSTRUMENT_ME, &mysql->field_alloc, 8192, 0,
|
||||
MYF(mysql->options.use_thread_specific_memory ?
|
||||
MY_THREAD_SPECIFIC : 0));
|
||||
mysql->fields= 0;
|
||||
|
@ -753,6 +799,11 @@ enum option_id {
|
|||
OPT_keep_this_one_last
|
||||
};
|
||||
|
||||
static char *opt_strdup(const char *from, myf my_flags)
|
||||
{
|
||||
return my_strdup(key_memory_mysql_options, from, my_flags);
|
||||
}
|
||||
|
||||
static TYPELIB option_types={array_elements(default_options)-1,
|
||||
"options",default_options, NULL};
|
||||
|
||||
|
@ -762,12 +813,14 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
|
|||
|
||||
if (!options->init_commands)
|
||||
{
|
||||
options->init_commands= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY),
|
||||
options->init_commands= (DYNAMIC_ARRAY*)my_malloc(key_memory_mysql_options,
|
||||
sizeof(DYNAMIC_ARRAY),
|
||||
MYF(MY_WME));
|
||||
my_init_dynamic_array(options->init_commands,sizeof(char*),5, 5, MYF(0));
|
||||
my_init_dynamic_array(options->init_commands, key_memory_mysql_options,
|
||||
sizeof(char*),5, 5, MYF(0));
|
||||
}
|
||||
|
||||
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
|
||||
if (!(tmp= opt_strdup(cmd,MYF(MY_WME))) ||
|
||||
insert_dynamic(options->init_commands, &tmp))
|
||||
{
|
||||
my_free(tmp);
|
||||
|
@ -780,7 +833,8 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
|
|||
|
||||
#define ALLOCATE_EXTENSIONS(OPTS) \
|
||||
(OPTS)->extension= (struct st_mysql_options_extention *) \
|
||||
my_malloc(sizeof(struct st_mysql_options_extention), \
|
||||
my_malloc(key_memory_mysql_options, \
|
||||
sizeof(struct st_mysql_options_extention), \
|
||||
MYF(MY_WME | MY_ZEROFILL)) \
|
||||
|
||||
|
||||
|
@ -802,7 +856,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
|
|||
} while (0)
|
||||
|
||||
#define EXTENSION_SET_STRING(OPTS, X, STR) \
|
||||
EXTENSION_SET_STRING_X(OPTS, X, STR, my_strdup)
|
||||
EXTENSION_SET_STRING_X(OPTS, X, STR, opt_strdup)
|
||||
|
||||
|
||||
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
|
||||
|
@ -816,7 +870,7 @@ static char *set_ssl_option_unpack_path(const char *arg, myf flags)
|
|||
{
|
||||
char buff[FN_REFLEN + 1];
|
||||
unpack_filename(buff, (char *)arg);
|
||||
return my_strdup(buff, flags);
|
||||
return opt_strdup(buff, flags);
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -824,8 +878,8 @@ static char *set_ssl_option_unpack_path(const char *arg, myf flags)
|
|||
#define EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, dup) do { } while(0)
|
||||
#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
|
||||
|
||||
#define SET_SSL_OPTION(OPTS, opt_var,arg) SET_SSL_OPTION_X(OPTS, opt_var, arg, my_strdup)
|
||||
#define EXTENSION_SET_SSL_STRING(OPTS, X, STR) EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, my_strdup)
|
||||
#define SET_SSL_OPTION(OPTS, opt_var,arg) SET_SSL_OPTION_X(OPTS, opt_var, arg, opt_strdup)
|
||||
#define EXTENSION_SET_SSL_STRING(OPTS, X, STR) EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, opt_strdup)
|
||||
#define SET_SSL_PATH_OPTION(OPTS, opt_var,arg) SET_SSL_OPTION_X(OPTS, opt_var, arg, set_ssl_option_unpack_path)
|
||||
#define EXTENSION_SET_SSL_PATH_STRING(OPTS, X, STR) EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, set_ssl_option_unpack_path)
|
||||
|
||||
|
@ -876,7 +930,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
|
|||
if (opt_arg)
|
||||
{
|
||||
my_free(options->unix_socket);
|
||||
options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
|
||||
options->unix_socket=opt_strdup(opt_arg,MYF(MY_WME));
|
||||
}
|
||||
break;
|
||||
case OPT_compress:
|
||||
|
@ -887,7 +941,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
|
|||
if (opt_arg)
|
||||
{
|
||||
my_free(options->password);
|
||||
options->password=my_strdup(opt_arg,MYF(MY_WME));
|
||||
options->password=opt_strdup(opt_arg,MYF(MY_WME));
|
||||
}
|
||||
break;
|
||||
case OPT_pipe:
|
||||
|
@ -902,7 +956,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
|
|||
if (opt_arg)
|
||||
{
|
||||
my_free(options->user);
|
||||
options->user=my_strdup(opt_arg,MYF(MY_WME));
|
||||
options->user=opt_strdup(opt_arg,MYF(MY_WME));
|
||||
}
|
||||
break;
|
||||
case OPT_init_command:
|
||||
|
@ -912,14 +966,14 @@ void mysql_read_default_options(struct st_mysql_options *options,
|
|||
if (opt_arg)
|
||||
{
|
||||
my_free(options->host);
|
||||
options->host=my_strdup(opt_arg,MYF(MY_WME));
|
||||
options->host=opt_strdup(opt_arg,MYF(MY_WME));
|
||||
}
|
||||
break;
|
||||
case OPT_database:
|
||||
if (opt_arg)
|
||||
{
|
||||
my_free(options->db);
|
||||
options->db=my_strdup(opt_arg,MYF(MY_WME));
|
||||
options->db=opt_strdup(opt_arg,MYF(MY_WME));
|
||||
}
|
||||
break;
|
||||
case OPT_debug:
|
||||
|
@ -953,11 +1007,11 @@ void mysql_read_default_options(struct st_mysql_options *options,
|
|||
break;
|
||||
case OPT_character_sets_dir:
|
||||
my_free(options->charset_dir);
|
||||
options->charset_dir = my_strdup(opt_arg, MYF(MY_WME));
|
||||
options->charset_dir = opt_strdup(opt_arg, MYF(MY_WME));
|
||||
break;
|
||||
case OPT_default_character_set:
|
||||
my_free(options->charset_name);
|
||||
options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
|
||||
options->charset_name = opt_strdup(opt_arg, MYF(MY_WME));
|
||||
break;
|
||||
case OPT_interactive_timeout:
|
||||
options->client_flag|= CLIENT_INTERACTIVE;
|
||||
|
@ -1201,14 +1255,14 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
|||
if ((pkt_len= cli_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(0);
|
||||
if (pkt_len == 0) DBUG_RETURN(0);
|
||||
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
|
||||
if (!(result=(MYSQL_DATA*) my_malloc(key_memory_MYSQL_DATA, sizeof(MYSQL_DATA),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/* Assume rowlength < 8192 */
|
||||
init_alloc_root(&result->alloc, "result", 8192, 0,
|
||||
init_alloc_root(key_memory_MYSQL_DATA, &result->alloc, 8192, 0,
|
||||
MYF(mysql->options.use_thread_specific_memory ?
|
||||
MY_THREAD_SPECIFIC : 0));
|
||||
result->alloc.min_malloc=sizeof(MYSQL_ROWS);
|
||||
|
@ -1352,7 +1406,8 @@ mysql_init(MYSQL *mysql)
|
|||
return 0;
|
||||
if (!mysql)
|
||||
{
|
||||
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
|
||||
if (!(mysql=(MYSQL*) my_malloc(key_memory_MYSQL,
|
||||
sizeof(*mysql), MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
set_mysql_error(NULL, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
return 0;
|
||||
|
@ -1664,7 +1719,7 @@ mysql_autodetect_character_set(MYSQL *mysql)
|
|||
{
|
||||
if (mysql->options.charset_name)
|
||||
my_free(mysql->options.charset_name);
|
||||
if (!(mysql->options.charset_name= my_strdup(my_default_csname(),MYF(MY_WME))))
|
||||
if (!(mysql->options.charset_name= opt_strdup(my_default_csname(),MYF(MY_WME))))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2191,7 +2246,7 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
|
|||
if (mpvio->db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
|
||||
{
|
||||
end= strmake(end, mpvio->db, NAME_LEN) + 1;
|
||||
mysql->db= my_strdup(mpvio->db, MYF(MY_WME));
|
||||
mysql->db= my_strdup(key_memory_MYSQL, mpvio->db, MYF(MY_WME));
|
||||
}
|
||||
|
||||
if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH)
|
||||
|
@ -2985,7 +3040,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
goto error;
|
||||
|
||||
/* Save connection information */
|
||||
if (!my_multi_malloc(MYF(0),
|
||||
if (!my_multi_malloc(key_memory_MYSQL, MYF(0),
|
||||
&mysql->host_info, (uint) strlen(host_info)+1,
|
||||
&mysql->host, (uint) strlen(host)+1,
|
||||
&mysql->unix_socket,unix_socket ?
|
||||
|
@ -2993,8 +3048,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
&mysql->server_version,
|
||||
(uint) (server_version_end - (char*) net->read_pos + 1),
|
||||
NullS) ||
|
||||
!(mysql->user=my_strdup(user,MYF(0))) ||
|
||||
!(mysql->passwd=my_strdup(passwd,MYF(0))))
|
||||
!(mysql->user=my_strdup(key_memory_MYSQL, user,MYF(0))) ||
|
||||
!(mysql->passwd=my_strdup(key_memory_MYSQL, passwd,MYF(0))))
|
||||
{
|
||||
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
goto error;
|
||||
|
@ -3255,7 +3310,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
|||
(ulong) strlen(db),0)))
|
||||
DBUG_RETURN(error);
|
||||
my_free(mysql->db);
|
||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||
mysql->db=my_strdup(key_memory_MYSQL, db,MYF(MY_WME));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -3582,7 +3637,8 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
mysql->status=MYSQL_STATUS_READY; /* server is ready */
|
||||
if (!(result=(MYSQL_RES*) my_malloc((uint) (sizeof(MYSQL_RES)+
|
||||
if (!(result=(MYSQL_RES*) my_malloc(key_memory_MYSQL_RES,
|
||||
(uint) (sizeof(MYSQL_RES)+
|
||||
sizeof(ulong) *
|
||||
mysql->field_count),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
|
@ -3635,15 +3691,17 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
|
|||
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+
|
||||
if (!(result=(MYSQL_RES*) my_malloc(key_memory_MYSQL_RES,
|
||||
sizeof(*result)+
|
||||
sizeof(ulong)*mysql->field_count,
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
DBUG_RETURN(0);
|
||||
result->lengths=(ulong*) (result+1);
|
||||
result->methods= mysql->methods;
|
||||
if (!(result->row=(MYSQL_ROW)
|
||||
my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
|
||||
{ /* Ptrs: to one row */
|
||||
my_malloc(key_memory_MYSQL_ROW,
|
||||
sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
|
||||
{ /* Ptrs: to one row */
|
||||
my_free(result);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -3773,19 +3831,19 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
|||
break;
|
||||
case MYSQL_READ_DEFAULT_FILE:
|
||||
my_free(mysql->options.my_cnf_file);
|
||||
mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME));
|
||||
mysql->options.my_cnf_file= opt_strdup(arg,MYF(MY_WME));
|
||||
break;
|
||||
case MYSQL_READ_DEFAULT_GROUP:
|
||||
my_free(mysql->options.my_cnf_group);
|
||||
mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME));
|
||||
mysql->options.my_cnf_group= opt_strdup(arg,MYF(MY_WME));
|
||||
break;
|
||||
case MYSQL_SET_CHARSET_DIR:
|
||||
my_free(mysql->options.charset_dir);
|
||||
mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME));
|
||||
mysql->options.charset_dir= opt_strdup(arg,MYF(MY_WME));
|
||||
break;
|
||||
case MYSQL_SET_CHARSET_NAME:
|
||||
my_free(mysql->options.charset_name);
|
||||
mysql->options.charset_name=my_strdup(arg,MYF(MY_WME));
|
||||
mysql->options.charset_name= opt_strdup(arg,MYF(MY_WME));
|
||||
break;
|
||||
case MYSQL_OPT_PROTOCOL:
|
||||
mysql->options.protocol= *(uint*) arg;
|
||||
|
@ -3797,7 +3855,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
|||
break;
|
||||
case MYSQL_SET_CLIENT_IP:
|
||||
my_free(mysql->options.client_ip);
|
||||
mysql->options.client_ip= my_strdup(arg, MYF(MY_WME));
|
||||
mysql->options.client_ip= opt_strdup(arg, MYF(MY_WME));
|
||||
break;
|
||||
case MYSQL_SECURE_AUTH:
|
||||
mysql->options.secure_auth= *(my_bool *) arg;
|
||||
|
@ -3828,7 +3886,8 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
|||
case MYSQL_PROGRESS_CALLBACK:
|
||||
if (!mysql->options.extension)
|
||||
mysql->options.extension= (struct st_mysql_options_extention *)
|
||||
my_malloc(sizeof(struct st_mysql_options_extention),
|
||||
my_malloc(key_memory_mysql_options,
|
||||
sizeof(struct st_mysql_options_extention),
|
||||
MYF(MY_WME | MY_ZEROFILL));
|
||||
if (mysql->options.extension)
|
||||
mysql->options.extension->report_progress=
|
||||
|
@ -3848,7 +3907,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
|||
my_free(ctxt);
|
||||
}
|
||||
if (!(ctxt= (struct mysql_async_context *)
|
||||
my_malloc(sizeof(*ctxt), MYF(MY_ZEROFILL))))
|
||||
my_malloc(PSI_INSTRUMENT_ME, sizeof(*ctxt), MYF(MY_ZEROFILL))))
|
||||
{
|
||||
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
|
@ -3990,13 +4049,13 @@ mysql_options4(MYSQL *mysql,enum mysql_option option,
|
|||
{
|
||||
if (my_hash_init(&mysql->options.extension->connection_attributes,
|
||||
&my_charset_bin, 0, 0, 0, (my_hash_get_key) get_attr_key,
|
||||
my_free, HASH_UNIQUE))
|
||||
my_free, HASH_UNIQUE, key_memory_mysql_options))
|
||||
{
|
||||
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
if (!my_multi_malloc(MY_WME,
|
||||
if (!my_multi_malloc(key_memory_mysql_options, MYF(MY_WME),
|
||||
&elt, 2 * sizeof(LEX_STRING),
|
||||
&key, key_len + 1,
|
||||
&value, value_len + 1,
|
||||
|
|
|
@ -38,6 +38,36 @@
|
|||
#include "errmsg.h"
|
||||
#include <mysql/client_plugin.h>
|
||||
|
||||
PSI_memory_key key_memory_root;
|
||||
PSI_memory_key key_memory_load_env_plugins;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
PSI_mutex_key key_mutex_LOCK_load_client_plugin;
|
||||
|
||||
static PSI_mutex_info all_client_plugin_mutexes[]=
|
||||
{
|
||||
{&key_mutex_LOCK_load_client_plugin, "LOCK_load_client_plugin", PSI_FLAG_GLOBAL}
|
||||
};
|
||||
|
||||
static PSI_memory_info all_client_plugin_memory[]=
|
||||
{
|
||||
{&key_memory_root, "root", PSI_FLAG_GLOBAL},
|
||||
{&key_memory_load_env_plugins, "load_env_plugins", PSI_FLAG_GLOBAL}
|
||||
};
|
||||
|
||||
static void init_client_plugin_psi_keys()
|
||||
{
|
||||
const char* category= "sql";
|
||||
int count;
|
||||
|
||||
count= array_elements(all_client_plugin_mutexes);
|
||||
mysql_mutex_register(category, all_client_plugin_mutexes, count);
|
||||
|
||||
count= array_elements(all_client_plugin_memory);
|
||||
mysql_memory_register(category, all_client_plugin_memory, count);
|
||||
}
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
struct st_client_plugin_int {
|
||||
struct st_client_plugin_int *next;
|
||||
void *dlhandle;
|
||||
|
@ -209,7 +239,7 @@ static void load_env_plugins(MYSQL *mysql)
|
|||
if (!s)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
free_env= plugs= my_strdup(s, MYF(MY_WME));
|
||||
free_env= plugs= my_strdup(key_memory_load_env_plugins, s, MYF(MY_WME));
|
||||
|
||||
do {
|
||||
if ((s= strchr(plugs, ';')))
|
||||
|
@ -242,11 +272,16 @@ int mysql_client_plugin_init()
|
|||
if (initialized)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
init_client_plugin_psi_keys();
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
|
||||
bzero(&unused, sizeof unused);
|
||||
|
||||
mysql_mutex_init(0, &LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
|
||||
init_alloc_root(&mem_root, "client_plugin", 128, 128, MYF(0));
|
||||
mysql_mutex_init(key_mutex_LOCK_load_client_plugin,
|
||||
&LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
|
||||
init_alloc_root(key_memory_root, &mem_root, 128, 128, MYF(0));
|
||||
|
||||
bzero(&plugin_list, sizeof(plugin_list));
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ static bool resolve_sysvars(handlerton *hton, ha_create_table_option *rules)
|
|||
return 1;
|
||||
}
|
||||
DBUG_ASSERT(str.length());
|
||||
opt->values= my_strndup(str.ptr(), str.length()-1, MYF(MY_WME));
|
||||
opt->values= my_strndup(PSI_INSTRUMENT_ME, str.ptr(), str.length()-1, MYF(MY_WME));
|
||||
if (!opt->values)
|
||||
return 1;
|
||||
break;
|
||||
|
|
|
@ -25,7 +25,7 @@ static int read_string(File file, uchar**to, size_t length)
|
|||
DBUG_ENTER("read_string");
|
||||
|
||||
/* This can't use MY_THREAD_SPECIFIC as it's used on server start */
|
||||
if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
|
||||
if (!(*to= (uchar*) my_malloc(PSI_INSTRUMENT_ME, length+1,MYF(MY_WME))) ||
|
||||
mysql_file_read(file, *to, length, MYF(MY_NABP)))
|
||||
{
|
||||
my_free(*to);
|
||||
|
|
|
@ -236,7 +236,8 @@ void debug_sync_init_thread(THD *thd)
|
|||
if (opt_debug_sync_timeout)
|
||||
{
|
||||
thd->debug_sync_control= (st_debug_sync_control*)
|
||||
my_malloc(sizeof(st_debug_sync_control),
|
||||
my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(st_debug_sync_control),
|
||||
MYF(MY_WME | MY_ZEROFILL | MY_THREAD_SPECIFIC));
|
||||
if (!thd->debug_sync_control)
|
||||
{
|
||||
|
@ -657,7 +658,7 @@ static st_debug_sync_action *debug_sync_get_action(THD *thd,
|
|||
if (ds_control->ds_active > ds_control->ds_allocated)
|
||||
{
|
||||
uint new_alloc= ds_control->ds_active + 3;
|
||||
void *new_action= my_realloc(ds_control->ds_action,
|
||||
void *new_action= my_realloc(PSI_NOT_INSTRUMENTED, ds_control->ds_action,
|
||||
new_alloc * sizeof(st_debug_sync_action),
|
||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||
if (!new_action)
|
||||
|
|
|
@ -120,8 +120,9 @@ bool init_errmessage(void)
|
|||
all_errors+= errors_per_range[i];
|
||||
|
||||
if (!(original_error_messages= (const char***)
|
||||
my_malloc((all_errors + MAX_ERROR_RANGES)* sizeof(void*),
|
||||
MYF(MY_ZEROFILL))))
|
||||
my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
(all_errors + MAX_ERROR_RANGES)*sizeof(void*),
|
||||
MYF(MY_ZEROFILL))))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
errmsgs= (const char**)(original_error_messages + MAX_ERROR_RANGES);
|
||||
|
@ -315,7 +316,8 @@ bool read_texts(const char *file_name, const char *language,
|
|||
DBUG_RETURN(1);
|
||||
|
||||
if (!(*data= (const char***)
|
||||
my_malloc((size_t) ((MAX_ERROR_RANGES+1) * sizeof(char**) +
|
||||
my_malloc(key_memory_errmsgs,
|
||||
(size_t) ((MAX_ERROR_RANGES+1) * sizeof(char**) +
|
||||
MY_MAX(msg_file.text_length, msg_file.errors * 2)+
|
||||
msg_file.errors * sizeof(char*)),
|
||||
MYF(MY_WME))))
|
||||
|
|
|
@ -76,7 +76,8 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len)
|
|||
|
||||
// Read whole frm file
|
||||
error= 3;
|
||||
if (!(read_data= (uchar*)my_malloc(read_len, MYF(MY_WME))))
|
||||
if (!(read_data= (uchar*)my_malloc(key_memory_frm_string, read_len,
|
||||
MYF(MY_WME))))
|
||||
goto err;
|
||||
if (mysql_file_read(file, read_data, read_len, MYF(MY_NABP)))
|
||||
{
|
||||
|
|
|
@ -173,11 +173,13 @@ Event_creation_ctx::load_from_db(THD *thd,
|
|||
*/
|
||||
|
||||
bool
|
||||
Event_queue_element_for_exec::init(const LEX_CSTRING *db, const LEX_CSTRING *n)
|
||||
Event_queue_element_for_exec::init(const LEX_CSTRING &db, const LEX_CSTRING &n)
|
||||
{
|
||||
if (!(dbname.str= my_strndup(db->str, dbname.length= db->length, MYF(MY_WME))))
|
||||
if (!(dbname.str= my_strndup(key_memory_Event_queue_element_for_exec_names,
|
||||
db.str, dbname.length= db.length, MYF(MY_WME))))
|
||||
return TRUE;
|
||||
if (!(name.str= my_strndup(n->str, name.length= n->length, MYF(MY_WME))))
|
||||
if (!(name.str= my_strndup(key_memory_Event_queue_element_for_exec_names,
|
||||
n.str, name.length= n.length, MYF(MY_WME))))
|
||||
{
|
||||
my_free(const_cast<char*>(dbname.str));
|
||||
return TRUE;
|
||||
|
@ -211,7 +213,7 @@ Event_basic::Event_basic()
|
|||
{
|
||||
DBUG_ENTER("Event_basic::Event_basic");
|
||||
/* init memory root */
|
||||
init_sql_alloc(&mem_root, "Event_basic", 256, 512, MYF(0));
|
||||
init_sql_alloc(key_memory_event_basic_root, &mem_root, 256, 512, MYF(0));
|
||||
dbname.str= name.str= NULL;
|
||||
dbname.length= name.length= 0;
|
||||
time_zone= NULL;
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
~Event_queue_element_for_exec();
|
||||
|
||||
bool
|
||||
init(const LEX_CSTRING *dbname, const LEX_CSTRING *name);
|
||||
init(const LEX_CSTRING &dbname, const LEX_CSTRING &name);
|
||||
|
||||
LEX_CSTRING dbname;
|
||||
LEX_CSTRING name;
|
||||
|
|
|
@ -637,7 +637,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
|
|||
}
|
||||
|
||||
if (!(*event_name= new Event_queue_element_for_exec()) ||
|
||||
(*event_name)->init(&top->dbname, &top->name))
|
||||
(*event_name)->init(top->dbname, top->name))
|
||||
{
|
||||
ret= TRUE;
|
||||
break;
|
||||
|
|
|
@ -411,7 +411,8 @@ Event_scheduler::start(int *err_no)
|
|||
|
||||
/* This should not be marked with MY_THREAD_SPECIFIC */
|
||||
scheduler_param_value=
|
||||
(struct scheduler_param *)my_malloc(sizeof(struct scheduler_param), MYF(0));
|
||||
(struct scheduler_param *)my_malloc(key_memory_Event_scheduler_scheduler_param,
|
||||
sizeof(struct scheduler_param), MYF(0));
|
||||
scheduler_param_value->thd= new_thd;
|
||||
scheduler_param_value->scheduler= this;
|
||||
|
||||
|
|
|
@ -1027,6 +1027,8 @@ PSI_stage_info stage_waiting_on_empty_queue= { 0, "Waiting on empty queue", 0};
|
|||
PSI_stage_info stage_waiting_for_next_activation= { 0, "Waiting for next activation", 0};
|
||||
PSI_stage_info stage_waiting_for_scheduler_to_stop= { 0, "Waiting for the scheduler to stop", 0};
|
||||
|
||||
PSI_memory_key key_memory_event_basic_root;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
PSI_stage_info *all_events_stages[]=
|
||||
{
|
||||
|
@ -1035,6 +1037,11 @@ PSI_stage_info *all_events_stages[]=
|
|||
& stage_waiting_for_scheduler_to_stop
|
||||
};
|
||||
|
||||
static PSI_memory_info all_events_memory[]=
|
||||
{
|
||||
{ &key_memory_event_basic_root, "Event_basic::mem_root", PSI_FLAG_GLOBAL}
|
||||
};
|
||||
|
||||
static void init_events_psi_keys(void)
|
||||
{
|
||||
const char* category= "sql";
|
||||
|
@ -1052,6 +1059,8 @@ static void init_events_psi_keys(void)
|
|||
count= array_elements(all_events_stages);
|
||||
mysql_stage_register(category, all_events_stages, count);
|
||||
|
||||
count= array_elements(all_events_memory);
|
||||
mysql_memory_register(category, all_events_memory, count);
|
||||
}
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ extern PSI_cond_key key_event_scheduler_COND_state;
|
|||
extern PSI_thread_key key_thread_event_scheduler, key_thread_event_worker;
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
extern PSI_memory_key key_memory_event_basic_root;
|
||||
|
||||
/* Always defined, for SHOW PROCESSLIST. */
|
||||
extern PSI_stage_info stage_waiting_on_empty_queue;
|
||||
extern PSI_stage_info stage_waiting_for_next_activation;
|
||||
|
|
|
@ -8074,7 +8074,7 @@ int Field_longstr::compress(char *to, uint to_length,
|
|||
max_length < length)
|
||||
{
|
||||
set_if_smaller(max_length, static_cast<ulonglong>(mbmaxlen()) * length + 1);
|
||||
if (!(buf= (char*) my_malloc(max_length, MYF(MY_WME))))
|
||||
if (!(buf= (char*) my_malloc(PSI_INSTRUMENT_ME, max_length, MYF(MY_WME))))
|
||||
{
|
||||
*out_length= 0;
|
||||
return -1;
|
||||
|
|
|
@ -312,7 +312,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
|
|||
param.using_pq= false;
|
||||
|
||||
if ((multi_byte_charset || param.using_packed_sortkeys()) &&
|
||||
!(param.tmp_buffer= (char*) my_malloc(param.sort_length,
|
||||
!(param.tmp_buffer= (char*) my_malloc(key_memory_Sort_param_tmp_buffer, param.sort_length,
|
||||
MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
||||
goto err;
|
||||
|
||||
|
@ -619,7 +619,8 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
|
|||
if (count > UINT_MAX/sizeof(Merge_chunk))
|
||||
return 0; /* sizeof(BUFFPEK)*count will overflow */
|
||||
if (!tmp)
|
||||
tmp= (uchar *)my_malloc(length, MYF(MY_WME | MY_THREAD_SPECIFIC));
|
||||
tmp= (uchar *)my_malloc(key_memory_Filesort_info_merge, length,
|
||||
MYF(MY_WME | MY_THREAD_SPECIFIC));
|
||||
if (tmp)
|
||||
{
|
||||
if (reinit_io_cache(buffpek_pointers,READ_CACHE,0L,0,0) ||
|
||||
|
@ -1452,8 +1453,8 @@ static bool save_index(Sort_param *param, uint count,
|
|||
res_length= param->res_length;
|
||||
offset= param->rec_length-res_length;
|
||||
if (!(to= table_sort->record_pointers=
|
||||
(uchar*) my_malloc(res_length*count,
|
||||
MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
||||
(uchar*) my_malloc(key_memory_Filesort_info_record_pointers,
|
||||
res_length*count, MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
for (uint ix= 0; ix < count; ++ix)
|
||||
{
|
||||
|
@ -2380,7 +2381,7 @@ get_addon_fields(TABLE *table, uint sortlength,
|
|||
|
||||
if (!filesort_use_addons(table, sortlength, &length, &fields, &null_fields,
|
||||
&packable_length) ||
|
||||
!(my_multi_malloc(MYF(MY_WME | MY_THREAD_SPECIFIC),
|
||||
!(my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME | MY_THREAD_SPECIFIC),
|
||||
&raw_mem, sizeof(Addon_fields),
|
||||
&raw_mem_addon_field,
|
||||
sizeof(SORT_ADDON_FIELD) * fields,
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "table.h"
|
||||
|
||||
|
||||
PSI_memory_key key_memory_Filesort_buffer_sort_keys;
|
||||
|
||||
namespace {
|
||||
/**
|
||||
A local helper function. See comments for get_merge_buffers_cost().
|
||||
|
@ -128,7 +130,8 @@ uchar *Filesort_buffer::alloc_sort_buffer(uint num_records,
|
|||
the old values
|
||||
*/
|
||||
my_free(m_rawmem);
|
||||
if (!(m_rawmem= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC))))
|
||||
if (!(m_rawmem= (uchar*) my_malloc(key_memory_Filesort_buffer_sort_keys,
|
||||
buff_size, MYF(MY_THREAD_SPECIFIC))))
|
||||
{
|
||||
m_size_in_bytes= 0;
|
||||
DBUG_RETURN(0);
|
||||
|
@ -137,7 +140,8 @@ uchar *Filesort_buffer::alloc_sort_buffer(uint num_records,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!(m_rawmem= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC))))
|
||||
if (!(m_rawmem= (uchar*) my_malloc(key_memory_Filesort_buffer_sort_keys,
|
||||
buff_size, MYF(MY_THREAD_SPECIFIC))))
|
||||
{
|
||||
m_size_in_bytes= 0;
|
||||
DBUG_RETURN(0);
|
||||
|
@ -177,7 +181,7 @@ void Filesort_buffer::sort_buffer(const Sort_param *param, uint count)
|
|||
uchar **buffer= NULL;
|
||||
if (!param->using_packed_sortkeys() &&
|
||||
radixsort_is_appliccable(count, param->sort_length) &&
|
||||
(buffer= (uchar**) my_malloc(count*sizeof(char*),
|
||||
(buffer= (uchar**) my_malloc(PSI_INSTRUMENT_ME, count*sizeof(char*),
|
||||
MYF(MY_THREAD_SPECIFIC))))
|
||||
{
|
||||
radixsort_for_str_ptr(m_sort_keys, count, param->sort_length, buffer);
|
||||
|
|
|
@ -204,7 +204,7 @@ void Gcalc_dyn_list::format_blk(void* block)
|
|||
|
||||
Gcalc_dyn_list::Item *Gcalc_dyn_list::alloc_new_blk()
|
||||
{
|
||||
void *new_block= my_malloc(m_blk_size, MYF(MY_WME));
|
||||
void *new_block= my_malloc(PSI_INSTRUMENT_ME, m_blk_size, MYF(MY_WME));
|
||||
if (!new_block)
|
||||
return NULL;
|
||||
*m_blk_hook= new_block;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "sql_priv.h"
|
||||
#include "gstream.h"
|
||||
#include "m_string.h" // LEX_STRING
|
||||
#include "mysqld.h"
|
||||
|
||||
enum Gis_read_stream::enum_tok_types Gis_read_stream::get_next_toc_type()
|
||||
{
|
||||
|
@ -140,6 +141,7 @@ bool Gis_read_stream::check_next_symbol(char symbol)
|
|||
void Gis_read_stream::set_error_msg(const char *msg)
|
||||
{
|
||||
size_t len= strlen(msg); // ok in this context
|
||||
m_err_msg= (char *) my_realloc(m_err_msg, (uint) len + 1, MYF(MY_ALLOW_ZERO_PTR));
|
||||
m_err_msg= (char *) my_realloc(key_memory_Gis_read_stream_err_msg,
|
||||
m_err_msg, (uint) len + 1, MYF(MY_ALLOW_ZERO_PTR));
|
||||
memcpy(m_err_msg, msg, len + 1);
|
||||
}
|
||||
|
|
|
@ -102,22 +102,43 @@ static const char *ha_partition_ext[]=
|
|||
ha_par_ext, NullS
|
||||
};
|
||||
|
||||
static PSI_memory_key key_memory_Partition_share;
|
||||
static PSI_memory_key key_memory_partition_sort_buffer;
|
||||
static PSI_memory_key key_memory_Partition_admin;
|
||||
|
||||
static PSI_memory_key key_memory_ha_partition_file;
|
||||
static PSI_memory_key key_memory_ha_partition_engine_array;
|
||||
static PSI_memory_key key_memory_ha_partition_part_ids;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
PSI_mutex_key key_partition_auto_inc_mutex;
|
||||
PSI_file_key key_file_ha_partition_par;
|
||||
|
||||
static PSI_mutex_info all_partition_mutexes[]=
|
||||
{
|
||||
{ &key_partition_auto_inc_mutex, "Partition_share::auto_inc_mutex", 0}
|
||||
};
|
||||
static PSI_memory_info all_partitioning_memory[]=
|
||||
{ { &key_memory_Partition_share, "Partition_share", 0},
|
||||
{ &key_memory_partition_sort_buffer, "partition_sort_buffer", 0},
|
||||
{ &key_memory_Partition_admin, "Partition_admin", 0},
|
||||
{ &key_memory_ha_partition_file, "ha_partition::file", 0},
|
||||
{ &key_memory_ha_partition_engine_array, "ha_partition::engine_array", 0},
|
||||
{ &key_memory_ha_partition_part_ids, "ha_partition::part_ids", 0} };
|
||||
static PSI_file_info all_partition_file[]=
|
||||
{ { &key_file_ha_partition_par, "ha_partition::parfile", 0} };
|
||||
|
||||
static void init_partition_psi_keys(void)
|
||||
{
|
||||
const char* category= "partition";
|
||||
int count;
|
||||
|
||||
count= array_elements(all_partitioning_memory);
|
||||
mysql_memory_register(category, all_partitioning_memory, count);
|
||||
count= array_elements(all_partition_mutexes);
|
||||
mysql_mutex_register(category, all_partition_mutexes, count);
|
||||
count= array_elements(all_partition_file);
|
||||
mysql_file_register(category, all_partition_file, count);
|
||||
}
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
|
@ -244,7 +265,7 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share)
|
|||
|
||||
void ha_partition::ha_partition_init()
|
||||
{
|
||||
init_alloc_root(&m_mem_root, "ha_partition", 512, 512, MYF(0));
|
||||
init_alloc_root(PSI_INSTRUMENT_ME, &m_mem_root, 512, 512, MYF(0));
|
||||
init_handler_variables();
|
||||
}
|
||||
|
||||
|
@ -649,9 +670,9 @@ int ha_partition::create_partitioning_metadata(const char *path,
|
|||
strxmov(name, path, ha_par_ext, NullS);
|
||||
strxmov(old_name, old_path, ha_par_ext, NullS);
|
||||
if ((action_flag == CHF_DELETE_FLAG &&
|
||||
mysql_file_delete(key_file_partition, name, MYF(MY_WME))) ||
|
||||
mysql_file_delete(key_file_ha_partition_par, name, MYF(MY_WME))) ||
|
||||
(action_flag == CHF_RENAME_FLAG &&
|
||||
mysql_file_rename(key_file_partition, old_name, name, MYF(MY_WME))))
|
||||
mysql_file_rename(key_file_ha_partition_par, old_name, name, MYF(MY_WME))))
|
||||
{
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
@ -1333,7 +1354,7 @@ bool print_admin_msg(THD* thd, uint len,
|
|||
char *msgbuf;
|
||||
bool error= true;
|
||||
|
||||
if (!(msgbuf= (char*) my_malloc(len, MYF(0))))
|
||||
if (!(msgbuf= (char*) my_malloc(key_memory_Partition_admin, len, MYF(0))))
|
||||
return true;
|
||||
va_start(args, fmt);
|
||||
msg_length= my_vsnprintf(msgbuf, len, fmt, args);
|
||||
|
@ -2749,7 +2770,8 @@ bool ha_partition::create_handler_file(const char *name)
|
|||
/* 4 static words (tot words, checksum, tot partitions, name length) */
|
||||
tot_len_words= 4 + tot_partition_words + tot_name_words;
|
||||
tot_len_byte= PAR_WORD_SIZE * tot_len_words;
|
||||
if (!(file_buffer= (uchar *) my_malloc(tot_len_byte, MYF(MY_ZEROFILL))))
|
||||
if (!(file_buffer= (uchar *) my_malloc(key_memory_ha_partition_file,
|
||||
tot_len_byte, MYF(MY_ZEROFILL))))
|
||||
DBUG_RETURN(TRUE);
|
||||
engine_array= (file_buffer + PAR_ENGINES_OFFSET);
|
||||
name_buffer_ptr= (char*) (engine_array + tot_partition_words * PAR_WORD_SIZE
|
||||
|
@ -2804,7 +2826,7 @@ bool ha_partition::create_handler_file(const char *name)
|
|||
to be used at open, delete_table and rename_table
|
||||
*/
|
||||
fn_format(file_name, name, "", ha_par_ext, MY_APPEND_EXT);
|
||||
if ((file= mysql_file_create(key_file_partition,
|
||||
if ((file= mysql_file_create(key_file_ha_partition_par,
|
||||
file_name, CREATE_MODE, O_RDWR | O_TRUNC,
|
||||
MYF(MY_WME))) >= 0)
|
||||
{
|
||||
|
@ -2829,7 +2851,7 @@ bool ha_partition::create_handler_file(const char *name)
|
|||
}
|
||||
(void) mysql_file_close(file, MYF(0));
|
||||
if (result)
|
||||
mysql_file_delete(key_file_partition, file_name, MYF(MY_WME));
|
||||
mysql_file_delete(key_file_ha_partition_par, file_name, MYF(MY_WME));
|
||||
}
|
||||
else
|
||||
result= TRUE;
|
||||
|
@ -2993,7 +3015,7 @@ bool ha_partition::read_par_file(const char *name)
|
|||
fn_format(buff, name, "", ha_par_ext, MY_APPEND_EXT);
|
||||
|
||||
/* Following could be done with mysql_file_stat to read in whole file */
|
||||
if ((file= mysql_file_open(key_file_partition,
|
||||
if ((file= mysql_file_open(key_file_ha_partition_par,
|
||||
buff, O_RDONLY | O_SHARE, MYF(0))) < 0)
|
||||
DBUG_RETURN(TRUE);
|
||||
if (mysql_file_read(file, (uchar *) &buff[0], PAR_WORD_SIZE, MYF(MY_NABP)))
|
||||
|
@ -3219,7 +3241,7 @@ bool ha_partition::insert_partition_name_in_hash(const char *name, uint part_id,
|
|||
Since we use my_multi_malloc, then my_free(part_def) will also free
|
||||
part_name, as a part of my_hash_free.
|
||||
*/
|
||||
if (!my_multi_malloc(MY_WME,
|
||||
if (!my_multi_malloc(key_memory_Partition_share, MY_WME,
|
||||
&part_def, sizeof(PART_NAME_DEF),
|
||||
&part_name, part_name_length + 1,
|
||||
NULL))
|
||||
|
@ -3270,7 +3292,7 @@ bool ha_partition::populate_partition_name_hash()
|
|||
if (my_hash_init(&part_share->partition_name_hash,
|
||||
system_charset_info, tot_names, 0, 0,
|
||||
(my_hash_get_key) get_part_name,
|
||||
my_free, HASH_UNIQUE))
|
||||
my_free, HASH_UNIQUE, key_memory_Partition_share))
|
||||
{
|
||||
unlock_shared_ha_data();
|
||||
DBUG_RETURN(TRUE);
|
||||
|
@ -3506,7 +3528,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
|
|||
if (!m_part_ids_sorted_by_num_of_records)
|
||||
{
|
||||
if (!(m_part_ids_sorted_by_num_of_records=
|
||||
(uint32*) my_malloc(m_tot_parts * sizeof(uint32), MYF(MY_WME))))
|
||||
(uint32*) my_malloc(key_memory_ha_partition_part_ids,
|
||||
m_tot_parts * sizeof(uint32), MYF(MY_WME))))
|
||||
DBUG_RETURN(error);
|
||||
uint32 i;
|
||||
/* Initialize it with all partition ids. */
|
||||
|
@ -3524,7 +3547,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
|
|||
|
||||
/* Allocate memory used with MMR */
|
||||
if (!(m_range_info= (void **)
|
||||
my_multi_malloc(MYF(MY_WME),
|
||||
my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME),
|
||||
&m_range_info, sizeof(range_id_t) * m_tot_parts,
|
||||
&m_stock_range_seq, sizeof(uint) * m_tot_parts,
|
||||
&m_mrr_buffer, sizeof(HANDLER_BUFFER) * m_tot_parts,
|
||||
|
@ -3535,8 +3558,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
|
|||
&m_part_mrr_range_current,
|
||||
sizeof(PARTITION_PART_KEY_MULTI_RANGE *) * m_tot_parts,
|
||||
&m_partition_part_key_multi_range_hld,
|
||||
sizeof(PARTITION_PART_KEY_MULTI_RANGE_HLD) *
|
||||
m_tot_parts,
|
||||
sizeof(PARTITION_PART_KEY_MULTI_RANGE_HLD) * m_tot_parts,
|
||||
NullS)))
|
||||
goto err_alloc;
|
||||
|
||||
|
@ -5315,7 +5337,8 @@ bool ha_partition::init_record_priority_queue()
|
|||
/* Allocate a key for temporary use when setting up the scan. */
|
||||
alloc_len+= table_share->max_key_length;
|
||||
|
||||
if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME))))
|
||||
if (!(m_ordered_rec_buffer= (uchar*)my_malloc(key_memory_partition_sort_buffer,
|
||||
alloc_len, MYF(MY_WME))))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
/*
|
||||
|
@ -6066,9 +6089,8 @@ int ha_partition::multi_range_key_create_key(RANGE_SEQ_IF *seq,
|
|||
if (!m_mrr_range_first)
|
||||
{
|
||||
if (!(m_mrr_range_first= (PARTITION_KEY_MULTI_RANGE *)
|
||||
my_multi_malloc(MYF(MY_WME),
|
||||
&m_mrr_range_current,
|
||||
sizeof(PARTITION_KEY_MULTI_RANGE),
|
||||
my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME),
|
||||
&m_mrr_range_current, sizeof(PARTITION_KEY_MULTI_RANGE),
|
||||
NullS)))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
|
@ -6085,9 +6107,8 @@ int ha_partition::multi_range_key_create_key(RANGE_SEQ_IF *seq,
|
|||
if (!m_part_mrr_range_first[i])
|
||||
{
|
||||
if (!(m_part_mrr_range_first[i]= (PARTITION_PART_KEY_MULTI_RANGE *)
|
||||
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
|
||||
&m_part_mrr_range_current[i],
|
||||
sizeof(PARTITION_PART_KEY_MULTI_RANGE),
|
||||
my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME | MY_ZEROFILL),
|
||||
&m_part_mrr_range_current[i], sizeof(PARTITION_PART_KEY_MULTI_RANGE),
|
||||
NullS)))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
@ -6123,7 +6144,7 @@ int ha_partition::multi_range_key_create_key(RANGE_SEQ_IF *seq,
|
|||
if (m_mrr_range_current->key[0])
|
||||
my_free(m_mrr_range_current->key[0]);
|
||||
if (!(m_mrr_range_current->key[0]=
|
||||
(uchar *) my_malloc(length, MYF(MY_WME))))
|
||||
(uchar *) my_malloc(PSI_INSTRUMENT_ME, length, MYF(MY_WME))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
m_mrr_range_current->length[0]= length;
|
||||
}
|
||||
|
@ -6147,7 +6168,7 @@ int ha_partition::multi_range_key_create_key(RANGE_SEQ_IF *seq,
|
|||
if (m_mrr_range_current->key[1])
|
||||
my_free(m_mrr_range_current->key[1]);
|
||||
if (!(m_mrr_range_current->key[1]=
|
||||
(uchar *) my_malloc(length, MYF(MY_WME))))
|
||||
(uchar *) my_malloc(PSI_INSTRUMENT_ME, length, MYF(MY_WME))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
m_mrr_range_current->length[1]= length;
|
||||
}
|
||||
|
@ -6181,7 +6202,7 @@ int ha_partition::multi_range_key_create_key(RANGE_SEQ_IF *seq,
|
|||
{
|
||||
PARTITION_PART_KEY_MULTI_RANGE *tmp_part_mrr_range;
|
||||
if (!(tmp_part_mrr_range= (PARTITION_PART_KEY_MULTI_RANGE *)
|
||||
my_malloc(sizeof(PARTITION_PART_KEY_MULTI_RANGE),
|
||||
my_malloc(PSI_INSTRUMENT_ME, sizeof(PARTITION_PART_KEY_MULTI_RANGE),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
|
@ -6201,7 +6222,7 @@ int ha_partition::multi_range_key_create_key(RANGE_SEQ_IF *seq,
|
|||
/* Add end of range sentinel */
|
||||
PARTITION_KEY_MULTI_RANGE *tmp_mrr_range;
|
||||
if (!(tmp_mrr_range= (PARTITION_KEY_MULTI_RANGE *)
|
||||
my_malloc(sizeof(PARTITION_KEY_MULTI_RANGE), MYF(MY_WME))))
|
||||
my_malloc(PSI_INSTRUMENT_ME, sizeof(PARTITION_KEY_MULTI_RANGE), MYF(MY_WME))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
tmp_mrr_range->id= m_mrr_range_current->id + 1;
|
||||
|
@ -6472,7 +6493,7 @@ int ha_partition::multi_range_read_init(RANGE_SEQ_IF *seq,
|
|||
if (m_mrr_full_buffer)
|
||||
my_free(m_mrr_full_buffer);
|
||||
if (!(m_mrr_full_buffer=
|
||||
(uchar *) my_malloc(m_mrr_new_full_buffer_size, MYF(MY_WME))))
|
||||
(uchar *) my_malloc(PSI_INSTRUMENT_ME, m_mrr_new_full_buffer_size, MYF(MY_WME))))
|
||||
{
|
||||
m_mrr_full_buffer_size= 0;
|
||||
error= HA_ERR_OUT_OF_MEM;
|
||||
|
@ -6870,11 +6891,9 @@ FT_INFO *ha_partition::ft_init_ext(uint flags, uint inx, String *key)
|
|||
{
|
||||
FT_INFO **tmp_ft_info;
|
||||
if (!(ft_target= (st_partition_ft_info *)
|
||||
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
|
||||
&ft_target,
|
||||
sizeof(st_partition_ft_info),
|
||||
&tmp_ft_info,
|
||||
sizeof(FT_INFO *) * m_tot_parts,
|
||||
my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME | MY_ZEROFILL),
|
||||
&ft_target, sizeof(st_partition_ft_info),
|
||||
&tmp_ft_info, sizeof(FT_INFO *) * m_tot_parts,
|
||||
NullS)))
|
||||
{
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATAL));
|
||||
|
|
|
@ -361,7 +361,8 @@ int ha_init_errors(void)
|
|||
|
||||
/* Allocate a pointer array for the error message strings. */
|
||||
/* Zerofill it to avoid uninitialized gaps. */
|
||||
if (! (handler_errmsgs= (const char**) my_malloc(HA_ERR_ERRORS * sizeof(char*),
|
||||
if (! (handler_errmsgs= (const char**) my_malloc(key_memory_handler_errmsgs,
|
||||
HA_ERR_ERRORS * sizeof(char*),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
return 1;
|
||||
|
||||
|
@ -531,7 +532,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
|
|||
DBUG_ENTER("ha_initialize_handlerton");
|
||||
DBUG_PRINT("plugin", ("initialize plugin: '%s'", plugin->name.str));
|
||||
|
||||
hton= (handlerton *)my_malloc(sizeof(handlerton),
|
||||
hton= (handlerton *)my_malloc(key_memory_handlerton, sizeof(handlerton),
|
||||
MYF(MY_WME | MY_ZEROFILL));
|
||||
if (hton == NULL)
|
||||
{
|
||||
|
@ -2216,7 +2217,7 @@ int ha_recover(HASH *commit_list)
|
|||
info.list==0 && info.len > MIN_XID_LIST_SIZE; info.len/=2)
|
||||
{
|
||||
DBUG_EXECUTE_IF("min_xa_len", info.len = 16;);
|
||||
info.list=(XID *)my_malloc(info.len*sizeof(XID), MYF(0));
|
||||
info.list=(XID *)my_malloc(key_memory_XID, info.len*sizeof(XID), MYF(0));
|
||||
}
|
||||
if (!info.list)
|
||||
{
|
||||
|
@ -4941,7 +4942,7 @@ void handler::update_global_table_stats()
|
|||
table->s->table_cache_key.length)))
|
||||
{
|
||||
if (!(table_stats = ((TABLE_STATS*)
|
||||
my_malloc(sizeof(TABLE_STATS),
|
||||
my_malloc(PSI_INSTRUMENT_ME, sizeof(TABLE_STATS),
|
||||
MYF(MY_WME | MY_ZEROFILL)))))
|
||||
{
|
||||
/* Out of memory error already given */
|
||||
|
@ -5006,7 +5007,7 @@ void handler::update_global_index_stats()
|
|||
key_length)))
|
||||
{
|
||||
if (!(index_stats = ((INDEX_STATS*)
|
||||
my_malloc(sizeof(INDEX_STATS),
|
||||
my_malloc(PSI_INSTRUMENT_ME, sizeof(INDEX_STATS),
|
||||
MYF(MY_WME | MY_ZEROFILL)))))
|
||||
goto end; // Error is already given
|
||||
|
||||
|
@ -7221,7 +7222,7 @@ int del_global_table_stat(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *ta
|
|||
|
||||
cache_key_length= db->length + 1 + table->length + 1;
|
||||
|
||||
if(!(cache_key= (uchar *)my_malloc(cache_key_length,
|
||||
if(!(cache_key= (uchar *)my_malloc(PSI_INSTRUMENT_ME, cache_key_length,
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
/* Out of memory error already given */
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue