Skip to content
Permalink
Browse files
MDEV-23526 InnoDB leaks memory for some static objects
A leak of the contents of fil_system.ssd that was introduced in
commit 10dd290 (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.
  • Loading branch information
dr-m committed Aug 21, 2020
1 parent 2643249 commit 688fb63
Showing 1 changed file with 21 additions and 15 deletions.
@@ -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);

if (is_initialised()) {
m_initialised = false;
hash_table_free(spaces);
spaces = NULL;
mutex_free(&mutex);
fil_space_crypt_cleanup();
}
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 = 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 */
}

/*******************************************************************//**

0 comments on commit 688fb63

Please sign in to comment.