diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-01-29 13:50:26 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-03-10 19:24:22 +0100 |
commit | 7c58e97bf6f80a251046c5b3e7bce826fe058bd6 (patch) | |
tree | 7d32d26b320cf83296ee0ede2ea164ad116c4de8 /extra/replace.c | |
parent | 2ac3121af2767186c489054db5d4871d04b8eef4 (diff) | |
download | mariadb-git-7c58e97bf6f80a251046c5b3e7bce826fe058bd6.tar.gz |
perfschema memory related instrumentation changes
Diffstat (limited to 'extra/replace.c')
-rw-r--r-- | extra/replace.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/extra/replace.c b/extra/replace.c index 717bc92d0c4..0d35c6d0194 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -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); } |