Commit 66791e5a authored by marko's avatar marko

branches/zip: Free the buffer pool at shutdown.

buf_pool_free(): New function: Free all chunks of the buffer pool.

innobase_shutdown_for_mysql(): Call buf_pool_free() right before
ut_free_all_mem().
parent 7d18bba5
......@@ -961,6 +961,29 @@ buf_pool_init(void)
return(buf_pool);
}
/************************************************************************
Frees the buffer pool at shutdown. This must not be invoked before
freeing all mutexes. */
void
buf_pool_free(void)
/*===============*/
{
buf_chunk_t* chunk;
buf_chunk_t* chunks;
chunks = buf_pool->chunks;
chunk = chunks + buf_pool->n_chunks;
while (--chunk >= chunks) {
/* Bypass the checks of buf_chunk_free(), since they
would fail at shutdown. */
os_mem_free_large(chunk->mem, chunk->mem_size);
}
buf_pool->n_chunks = 0;
}
/************************************************************************
Relocate a buffer control block. Relocates the block on the LRU list
and in buf_pool->page_hash. Does not relocate bpage->list. */
......
......@@ -86,6 +86,14 @@ buf_pool_init(void);
/*===============*/
/* out, own: buf_pool object, NULL if not
enough memory or error */
/************************************************************************
Frees the buffer pool at shutdown. This must not be invoked before
freeing all mutexes. */
void
buf_pool_free(void);
/*===============*/
/************************************************************************
Relocate a buffer control block. Relocates the block on the LRU list
and in buf_pool->page_hash. Does not relocate bpage->list. */
......
......@@ -1895,6 +1895,7 @@ innobase_shutdown_for_mysql(void)
/* 5. Free all allocated memory and the os_fast_mutex created in
ut0mem.c */
buf_pool_free();
ut_free_all_mem();
if (os_thread_count != 0
......
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