summaryrefslogtreecommitdiff
path: root/innobase/mem
diff options
context:
space:
mode:
authorheikki@donna.mysql.fi <>2002-01-29 22:29:58 +0200
committerheikki@donna.mysql.fi <>2002-01-29 22:29:58 +0200
commit6202aa7c8ebcd3b27a0140f862aeafc1fecb8500 (patch)
tree727a358e25fb4686c20270d24a2f90e3eeed6aab /innobase/mem
parent8a7ecfb9e011d99c7dc2f79974b488c1ca928d8e (diff)
downloadmariadb-git-6202aa7c8ebcd3b27a0140f862aeafc1fecb8500.tar.gz
mem0mem.c:
Add more diagnostic code to cath possible memory corruption
Diffstat (limited to 'innobase/mem')
-rw-r--r--innobase/mem/mem0mem.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/innobase/mem/mem0mem.c b/innobase/mem/mem0mem.c
index 58fb618e2db..3e0a9c008f3 100644
--- a/innobase/mem/mem0mem.c
+++ b/innobase/mem/mem0mem.c
@@ -50,7 +50,7 @@ of the blocks stay the same. An exception is, of course, the case
where the caller requests a memory buffer whose size is
bigger than the threshold. In that case a block big enough must
be allocated.
-
+
The heap is physically arranged so that if the current block
becomes full, a new block is allocated and always inserted in the
chain of blocks as the last block.
@@ -119,6 +119,10 @@ mem_heap_create_block(
ut_ad((type == MEM_HEAP_DYNAMIC) || (type == MEM_HEAP_BUFFER)
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
+ if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) {
+ mem_analyze_corruption((byte*)heap);
+ }
+
/* In dynamic allocation, calculate the size: block header + data. */
if (init_block != NULL) {
@@ -251,6 +255,10 @@ mem_heap_block_free(
ulint len;
ibool init_block;
+ if (block->magic_n != MEM_BLOCK_MAGIC_N) {
+ mem_analyze_corruption((byte*)block);
+ }
+
UT_LIST_REMOVE(list, heap->base, block);
type = heap->type;