MDEV-23526 InnoDB leaks memory for some static objects
A leak of the contents of fil_system.ssd that was introduced in commit 10dd290b4b8b8b235c8cf42e100f0a4415629e79 (MDEV-17380) was caught by implementing SAFEMALLOC instrumentation of operator new. I did not try to find out how to make AddressSanitizer or Valgrind detect it. fil_system_t::close(): Clear fil_system.ssd. The leak was identified and a fix suggested by Michael Widenius and Vicențiu Ciorbaru.
This commit is contained in:
parent
2643249da5
commit
688fb6301c
@ -1610,22 +1610,28 @@ void fil_system_t::create(ulint hash_size)
|
||||
|
||||
void fil_system_t::close()
|
||||
{
|
||||
ut_ad(this == &fil_system);
|
||||
ut_a(!UT_LIST_GET_LEN(LRU));
|
||||
ut_a(unflushed_spaces.empty());
|
||||
ut_a(!UT_LIST_GET_LEN(space_list));
|
||||
ut_ad(!sys_space);
|
||||
ut_ad(!temp_space);
|
||||
ut_ad(this == &fil_system);
|
||||
ut_a(!UT_LIST_GET_LEN(LRU));
|
||||
ut_a(unflushed_spaces.empty());
|
||||
ut_a(!UT_LIST_GET_LEN(space_list));
|
||||
ut_ad(!sys_space);
|
||||
ut_ad(!temp_space);
|
||||
|
||||
if (is_initialised()) {
|
||||
m_initialised = false;
|
||||
hash_table_free(spaces);
|
||||
spaces = NULL;
|
||||
mutex_free(&mutex);
|
||||
fil_space_crypt_cleanup();
|
||||
}
|
||||
if (is_initialised())
|
||||
{
|
||||
m_initialised= false;
|
||||
hash_table_free(spaces);
|
||||
spaces = nullptr;
|
||||
mutex_free(&mutex);
|
||||
fil_space_crypt_cleanup();
|
||||
}
|
||||
|
||||
ut_ad(!spaces);
|
||||
ut_ad(!spaces);
|
||||
|
||||
#ifdef UNIV_LINUX
|
||||
ssd.clear();
|
||||
ssd.shrink_to_fit();
|
||||
#endif /* UNIV_LINUX */
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
|
Loading…
x
Reference in New Issue
Block a user