diff options
author | unknown <knielsen@knielsen-hq.org> | 2010-08-04 10:39:53 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2010-08-04 10:39:53 +0200 |
commit | 3f1c763a94cd25c4810692983f6e61b528e21268 (patch) | |
tree | d8f9632933303f9bdf8cdc875613ca99f51ecbcb /storage/xtradb/mem | |
parent | a74d04671d23fa65bd610184965cc2974ec41cf9 (diff) | |
parent | 0c6afe17dceb926b5c757157308188e540caec1e (diff) | |
download | mariadb-git-3f1c763a94cd25c4810692983f6e61b528e21268.tar.gz |
Merge XtraDB from Percona-Server-5.1.47-11 into MariaDB.
Diffstat (limited to 'storage/xtradb/mem')
-rw-r--r-- | storage/xtradb/mem/mem0dbg.c | 6 | ||||
-rw-r--r-- | storage/xtradb/mem/mem0mem.c | 20 |
2 files changed, 24 insertions, 2 deletions
diff --git a/storage/xtradb/mem/mem0dbg.c b/storage/xtradb/mem/mem0dbg.c index 01eda20ec45..1cd2ff15bab 100644 --- a/storage/xtradb/mem/mem0dbg.c +++ b/storage/xtradb/mem/mem0dbg.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -180,6 +180,10 @@ mem_close(void) { mem_pool_free(mem_comm_pool); mem_comm_pool = NULL; +#ifdef UNIV_MEM_DEBUG + mutex_free(&mem_hash_mutex); + mem_hash_initialized = FALSE; +#endif /* UNIV_MEM_DEBUG */ } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/xtradb/mem/mem0mem.c b/storage/xtradb/mem/mem0mem.c index ccb2fd8a7b4..c0ce8a3e1ac 100644 --- a/storage/xtradb/mem/mem0mem.c +++ b/storage/xtradb/mem/mem0mem.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -383,6 +383,20 @@ mem_heap_create_block( mem_block_set_free(block, MEM_BLOCK_HEADER_SIZE); mem_block_set_start(block, MEM_BLOCK_HEADER_SIZE); + if (UNIV_UNLIKELY(heap == NULL)) { + /* This is the first block of the heap. The field + total_size should be initialized here */ + block->total_size = len; + } else { + /* Not the first allocation for the heap. This block's + total_length field should be set to undefined. */ + ut_d(block->total_size = ULINT_UNDEFINED); + UNIV_MEM_INVALID(&block->total_size, + sizeof block->total_size); + + heap->total_size += len; + } + ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len); return(block); @@ -471,6 +485,10 @@ mem_heap_block_free( mem_pool_mutex_exit(); #endif + + ut_ad(heap->total_size >= block->len); + heap->total_size -= block->len; + type = heap->type; len = block->len; block->magic_n = MEM_FREED_BLOCK_MAGIC_N; |