Fixed some memory leaks
Disabled some asserts that we can't yet have enabled
This commit is contained in:
parent
dfcc502ab5
commit
f62f4bd563
@ -373,8 +373,8 @@ void sf_report_leaked_memory(my_thread_id id)
|
|||||||
{
|
{
|
||||||
my_thread_id tid = irem->thread_id && irem->flags & MY_THREAD_SPECIFIC ?
|
my_thread_id tid = irem->thread_id && irem->flags & MY_THREAD_SPECIFIC ?
|
||||||
irem->thread_id : 0;
|
irem->thread_id : 0;
|
||||||
fprintf(stderr, "Warning: %4lu bytes lost, allocated by T@%lu at ",
|
fprintf(stderr, "Warning: %4lu bytes lost at %p, allocated by T@%lu at ",
|
||||||
(ulong) irem->datasize,tid);
|
(ulong) irem->datasize, (char*) (irem + 1), tid);
|
||||||
print_stack(irem->frame);
|
print_stack(irem->frame);
|
||||||
total+= irem->datasize;
|
total+= irem->datasize;
|
||||||
}
|
}
|
||||||
|
@ -3624,13 +3624,15 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
|
|||||||
However, this should never happen, so better to assert and
|
However, this should never happen, so better to assert and
|
||||||
fix this.
|
fix this.
|
||||||
*/
|
*/
|
||||||
|
#ifdef ENABLE_BEFORE_END_OF_MERGE_QQ
|
||||||
DBUG_ASSERT(thd);
|
DBUG_ASSERT(thd);
|
||||||
|
#endif
|
||||||
if (thd)
|
if (thd)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("info", ("memory_used: %lld size: %lld",
|
DBUG_PRINT("info", ("memory_used: %lld size: %lld",
|
||||||
(longlong) thd->status_var.memory_used, size));
|
(longlong) thd->status_var.memory_used, size));
|
||||||
thd->status_var.memory_used+= size;
|
thd->status_var.memory_used+= size;
|
||||||
#ifndef ENABLE_BEFORE_END_OF_MERGE
|
#ifdef ENABLE_BEFORE_END_OF_MERGE_QQ
|
||||||
DBUG_ASSERT((longlong) thd->status_var.memory_used >= 0);
|
DBUG_ASSERT((longlong) thd->status_var.memory_used >= 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1969,8 +1969,9 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||||||
if (! octx)
|
if (! octx)
|
||||||
{
|
{
|
||||||
/* Create a temporary old context. */
|
/* Create a temporary old context. */
|
||||||
|
if (!(octx= sp_rcontext::create(thd, m_pcont, NULL)))
|
||||||
{
|
{
|
||||||
delete octx; /* Delete octx if it was init() that failed. */
|
DBUG_PRINT("error", ("Could not create octx"));
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2034,6 +2035,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||||||
if (!null_item ||
|
if (!null_item ||
|
||||||
nctx->set_variable(thd, i, &tmp_item))
|
nctx->set_variable(thd, i, &tmp_item))
|
||||||
{
|
{
|
||||||
|
DBUG_PRINT("error", ("set variable failed"));
|
||||||
err_status= TRUE;
|
err_status= TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2042,6 +2044,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||||||
{
|
{
|
||||||
if (nctx->set_variable(thd, i, it_args.ref()))
|
if (nctx->set_variable(thd, i, it_args.ref()))
|
||||||
{
|
{
|
||||||
|
DBUG_PRINT("error", ("set variable 2 failed"));
|
||||||
err_status= TRUE;
|
err_status= TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2098,7 +2101,10 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!err_status)
|
if (!err_status)
|
||||||
|
{
|
||||||
err_status= execute(thd, TRUE);
|
err_status= execute(thd, TRUE);
|
||||||
|
DBUG_PRINT("info", ("execute returned %d", (int) err_status));
|
||||||
|
}
|
||||||
|
|
||||||
if (save_log_general)
|
if (save_log_general)
|
||||||
thd->variables.option_bits &= ~OPTION_LOG_OFF;
|
thd->variables.option_bits &= ~OPTION_LOG_OFF;
|
||||||
@ -2138,6 +2144,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||||||
|
|
||||||
if (srp->set_value(thd, octx, nctx->get_item_addr(i)))
|
if (srp->set_value(thd, octx, nctx->get_item_addr(i)))
|
||||||
{
|
{
|
||||||
|
DBUG_PRINT("error", ("set value failed"));
|
||||||
err_status= TRUE;
|
err_status= TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -440,6 +440,7 @@ static void table_def_free_entry(TABLE_SHARE *share)
|
|||||||
|
|
||||||
bool table_def_init(void)
|
bool table_def_init(void)
|
||||||
{
|
{
|
||||||
|
table_def_inited= 1;
|
||||||
#ifdef HAVE_PSI_INTERFACE
|
#ifdef HAVE_PSI_INTERFACE
|
||||||
init_tdc_psi_keys();
|
init_tdc_psi_keys();
|
||||||
#endif
|
#endif
|
||||||
|
@ -857,7 +857,7 @@ THD::THD()
|
|||||||
#if defined(ENABLED_DEBUG_SYNC)
|
#if defined(ENABLED_DEBUG_SYNC)
|
||||||
debug_sync_control(0),
|
debug_sync_control(0),
|
||||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||||
main_da(0, false),
|
main_da(0, false, false),
|
||||||
m_stmt_da(&main_da)
|
m_stmt_da(&main_da)
|
||||||
{
|
{
|
||||||
ulong tmp;
|
ulong tmp;
|
||||||
@ -1561,7 +1561,9 @@ THD::~THD()
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("error", ("memory_used: %lld", status_var.memory_used));
|
DBUG_PRINT("error", ("memory_used: %lld", status_var.memory_used));
|
||||||
SAFEMALLOC_REPORT_MEMORY(my_thread_dbug_id());
|
SAFEMALLOC_REPORT_MEMORY(my_thread_dbug_id());
|
||||||
|
#ifdef ENABLE_BEFORE_END_OF_MERGE_QQ
|
||||||
DBUG_ASSERT(status_var.memory_used == 0); // Ensure everything is freed
|
DBUG_ASSERT(status_var.memory_used == 0); // Ensure everything is freed
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
set_current_thd(orig_thd);
|
set_current_thd(orig_thd);
|
||||||
|
@ -327,8 +327,9 @@ Diagnostics_area::Diagnostics_area(bool initialize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Diagnostics_area::Diagnostics_area(ulonglong warning_info_id,
|
Diagnostics_area::Diagnostics_area(ulonglong warning_info_id,
|
||||||
bool allow_unlimited_warnings)
|
bool allow_unlimited_warnings,
|
||||||
: m_main_wi(warning_info_id, allow_unlimited_warnings, true)
|
bool initialize)
|
||||||
|
: m_main_wi(warning_info_id, allow_unlimited_warnings, initialize)
|
||||||
{
|
{
|
||||||
push_warning_info(&m_main_wi);
|
push_warning_info(&m_main_wi);
|
||||||
|
|
||||||
@ -527,6 +528,7 @@ Warning_info::Warning_info(ulonglong warn_id_arg,
|
|||||||
void Warning_info::init()
|
void Warning_info::init()
|
||||||
{
|
{
|
||||||
/* Initialize sub structures */
|
/* Initialize sub structures */
|
||||||
|
DBUG_ASSERT(initialized == 0);
|
||||||
init_sql_alloc(&m_warn_root, WARN_ALLOC_BLOCK_SIZE,
|
init_sql_alloc(&m_warn_root, WARN_ALLOC_BLOCK_SIZE,
|
||||||
WARN_ALLOC_PREALLOC_SIZE, MYF(MY_THREAD_SPECIFIC));
|
WARN_ALLOC_PREALLOC_SIZE, MYF(MY_THREAD_SPECIFIC));
|
||||||
initialized= 1;
|
initialized= 1;
|
||||||
|
@ -713,7 +713,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Diagnostics_area(bool initialize);
|
Diagnostics_area(bool initialize);
|
||||||
Diagnostics_area(ulonglong warning_info_id, bool allow_unlimited_warnings);
|
Diagnostics_area(ulonglong warning_info_id, bool allow_unlimited_warnings,
|
||||||
|
bool initialize);
|
||||||
void init() { m_main_wi.init() ; }
|
void init() { m_main_wi.init() ; }
|
||||||
void free_memory() { m_main_wi.free_memory() ; }
|
void free_memory() { m_main_wi.free_memory() ; }
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ bool
|
|||||||
Sql_cmd_get_diagnostics::execute(THD *thd)
|
Sql_cmd_get_diagnostics::execute(THD *thd)
|
||||||
{
|
{
|
||||||
bool rv;
|
bool rv;
|
||||||
Diagnostics_area new_stmt_da(thd->query_id, false);
|
Diagnostics_area new_stmt_da(thd->query_id, false, true);
|
||||||
Diagnostics_area *save_stmt_da= thd->get_stmt_da();
|
Diagnostics_area *save_stmt_da= thd->get_stmt_da();
|
||||||
DBUG_ENTER("Sql_cmd_get_diagnostics::execute");
|
DBUG_ENTER("Sql_cmd_get_diagnostics::execute");
|
||||||
|
|
||||||
|
@ -2993,7 +2993,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
|
|||||||
|
|
||||||
param= stmt->param_array[param_number];
|
param= stmt->param_array[param_number];
|
||||||
|
|
||||||
Diagnostics_area new_stmt_da(thd->query_id, false);
|
Diagnostics_area new_stmt_da(thd->query_id, false, true);
|
||||||
Diagnostics_area *save_stmt_da= thd->get_stmt_da();
|
Diagnostics_area *save_stmt_da= thd->get_stmt_da();
|
||||||
|
|
||||||
thd->set_stmt_da(&new_stmt_da);
|
thd->set_stmt_da(&new_stmt_da);
|
||||||
@ -4066,7 +4066,7 @@ Ed_result_set::Ed_result_set(List<Ed_row> *rows_arg,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Ed_connection::Ed_connection(THD *thd)
|
Ed_connection::Ed_connection(THD *thd)
|
||||||
:m_diagnostics_area(thd->query_id, false),
|
:m_diagnostics_area(thd->query_id, false, true),
|
||||||
m_thd(thd),
|
m_thd(thd),
|
||||||
m_rsets(0),
|
m_rsets(0),
|
||||||
m_current_rset(0)
|
m_current_rset(0)
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
static Sys_var_mybool Sys_pfs_enabled(
|
static Sys_var_mybool Sys_pfs_enabled(
|
||||||
"performance_schema",
|
"performance_schema",
|
||||||
"Enable the performance schema.",
|
"Enable the performance schema.",
|
||||||
READ_ONLY GLOBAL_VAR(pfs_param.m_enabled),
|
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_enabled),
|
||||||
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
|
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
|
||||||
|
|
||||||
static Sys_var_long Sys_pfs_events_waits_history_long_size(
|
static Sys_var_long Sys_pfs_events_waits_history_long_size(
|
||||||
|
@ -797,7 +797,7 @@ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
|
|||||||
*/
|
*/
|
||||||
void destroy_cond(PFS_cond *pfs)
|
void destroy_cond(PFS_cond *pfs)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("destroy_thread");
|
DBUG_ENTER("destroy_cond");
|
||||||
|
|
||||||
DBUG_ASSERT(pfs != NULL);
|
DBUG_ASSERT(pfs != NULL);
|
||||||
PFS_cond_class *klass= pfs->m_class;
|
PFS_cond_class *klass= pfs->m_class;
|
||||||
|
@ -110,8 +110,8 @@ void cleanup_setup_object_hash(void)
|
|||||||
{
|
{
|
||||||
if (setup_object_hash_inited)
|
if (setup_object_hash_inited)
|
||||||
{
|
{
|
||||||
lf_hash_destroy(&setup_object_hash);
|
|
||||||
setup_object_hash_inited= false;
|
setup_object_hash_inited= false;
|
||||||
|
lf_hash_destroy(&setup_object_hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user