diff options
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 15 | ||||
-rw-r--r-- | sql-common/client_plugin.c | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index d0f1a8d078c..675774b26a7 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -891,7 +891,8 @@ void free_old_query(MYSQL *mysql) DBUG_ENTER("free_old_query"); if (mysql->fields) free_root(&mysql->field_alloc,MYF(0)); - init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */ + /* Assume rowlength < 8192 */ + init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(MY_THREAD_SPECIFIC)); mysql->fields= 0; mysql->field_count= 0; /* For API */ mysql->warning_count= 0; @@ -1169,7 +1170,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) { options->init_commands= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY), MYF(MY_WME)); - init_dynamic_array(options->init_commands,sizeof(char*),5,5); + my_init_dynamic_array(options->init_commands,sizeof(char*),5, 5, 0); } if (!(tmp= my_strdup(cmd,MYF(MY_WME))) || @@ -1576,7 +1577,8 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); DBUG_RETURN(0); } - init_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */ + /* Assume rowlength < 8192 */ + init_alloc_root(&result->alloc, 8192, 0, MYF(MY_THREAD_SPECIFIC)); result->alloc.min_malloc=sizeof(MYSQL_ROWS); prev_ptr= &result->data; result->rows=0; @@ -3290,7 +3292,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, if (mysql->options.extension && mysql->options.extension->async_context) net->vio->async_context= mysql->options.extension->async_context; - if (my_net_init(net, net->vio)) + if (my_net_init(net, net->vio, + MYF(mysql->options.thread_specific_malloc ? + MY_THREAD_SPECIFIC : 0))) { vio_delete(net->vio); net->vio = 0; @@ -4218,6 +4222,9 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) mysql->options.extension->report_progress= (void (*)(const MYSQL *, uint, uint, double, const char *, uint)) arg; break; + case MYSQL_THREAD_SPECIFIC_MALLOC: + mysql->options.thread_specific_malloc= *(uint*) arg; + break; case MYSQL_OPT_NONBLOCK: if (mysql->options.extension && (ctxt = mysql->options.extension->async_context) != 0) diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c index f31ddb22a6a..bc0cff85eb6 100644 --- a/sql-common/client_plugin.c +++ b/sql-common/client_plugin.c @@ -251,7 +251,7 @@ int mysql_client_plugin_init() bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */ pthread_mutex_init(&LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW); - init_alloc_root(&mem_root, 128, 128); + init_alloc_root(&mem_root, 128, 128, 0); bzero(&plugin_list, sizeof(plugin_list)); |