Skip to content

Commit

Permalink
Remove some allocations not needed for internal temporary tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
montywi committed Feb 1, 2015
1 parent e787012 commit 67b24a2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions storage/heap/hp_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,12 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
my_free(share);
goto err;
}
thr_lock_init(&share->lock);
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
&share->intern_lock, MY_MUTEX_INIT_FAST);

if (!create_info->internal_table)
{
thr_lock_init(&share->lock);
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
&share->intern_lock, MY_MUTEX_INIT_FAST);
share->open_list.data= (void*) share;
heap_share_list= list_add(heap_share_list,&share->open_list);
}
Expand Down Expand Up @@ -340,11 +341,13 @@ void heap_drop_table(HP_INFO *info)

void hp_free(HP_SHARE *share)
{
if (share->open_list.data) /* If not internal table */
if (!share->internal)
{
heap_share_list= list_delete(heap_share_list, &share->open_list);
thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->intern_lock);
}
hp_clear(share); /* Remove blocks from memory */
thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->intern_lock);
my_free(share->name);
my_free(share);
return;
Expand Down

0 comments on commit 67b24a2

Please sign in to comment.