Commit 891b06eb authored by marko's avatar marko

branches/zip: Initialize ut_list_mutex at startup. Without this fix,

ut_list_mutex would be used uninitialized when innodb_use_sys_malloc=1.
This fix addresses Issue #181.

ut_mem_block_list_init(): Rename to ut_mem_init() and make public.

ut_malloc_low(), ut_free_all_mem(): Add ut_a(ut_mem_block_list_inited).

mem_init(): Call ut_mem_init().
parent d15afc73
......@@ -49,6 +49,12 @@ UNIV_INLINE
int
ut_memcmp(const void* str1, const void* str2, ulint n);
/**************************************************************************
Initializes the mem block list at database startup. */
UNIV_INTERN
void
ut_mem_init(void);
/*=============*/
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
......
......@@ -163,6 +163,8 @@ mem_init(
}
mem_comm_pool = mem_pool_create(size);
ut_mem_init();
}
#ifdef UNIV_MEM_DEBUG
......
......@@ -64,10 +64,10 @@ static ulint* ut_mem_null_ptr = NULL;
/**************************************************************************
Initializes the mem block list at database startup. */
static
UNIV_INTERN
void
ut_mem_block_list_init(void)
/*========================*/
ut_mem_init(void)
/*=============*/
{
os_fast_mutex_init(&ut_list_mutex);
UT_LIST_INIT(ut_mem_block_list);
......@@ -106,10 +106,7 @@ ut_malloc_low(
}
ut_ad((sizeof(ut_mem_block_t) % 8) == 0); /* check alignment ok */
if (UNIV_UNLIKELY(!ut_mem_block_list_inited)) {
ut_mem_block_list_init();
}
ut_a(ut_mem_block_list_inited);
retry_count = 0;
retry:
......@@ -383,10 +380,7 @@ ut_free_all_mem(void)
{
ut_mem_block_t* block;
if (!ut_mem_block_list_inited) {
return;
}
ut_a(ut_mem_block_list_inited);
ut_mem_block_list_inited = FALSE;
os_fast_mutex_free(&ut_list_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment