From d7bedeb998c911c921d7b67dc07049955481d9b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Mar 2003 21:23:13 +0200 Subject: Added support for ULONG division with DIV Fixed non fatal memory leak in slave code. mysql-test/r/func_test.result: Added test for DIV mysql-test/t/func_test.test: Added test for DIV mysys/my_alloc.c: More DBUG statements sql/item_func.cc: Added support for ULONG division with DIV sql/log_event.cc: Fixed memory leak (Wrong call to init_sql_alloc) sql/slave.cc: Fixed memory leak (Wrong call to init_sql_alloc) sql/sql_base.cc: More DBUG statements sql/sql_class.cc: Added init_for_queries() to fix memory leak in slave code sql/sql_class.h: Added init_for_queries() to fix memory leak in slave code sql/sql_error.cc: More DBUG statements sql/sql_parse.cc: Added init_for_queries() to fix memory leak in slave code sql/unireg.h: Moved memory defaults to include file --- mysys/my_alloc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mysys/my_alloc.c') diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 4d3b0604984..abd51369f95 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -25,6 +25,8 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size __attribute__((unused))) { + DBUG_ENTER("init_alloc_root"); + DBUG_PRINT("enter",("root: %lx", mem_root)); mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; @@ -45,24 +47,27 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, } } #endif + DBUG_VOID_RETURN; } gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) { #if defined(HAVE_purify) && defined(EXTRA_DEBUG) reg1 USED_MEM *next; - Size+=ALIGN_SIZE(sizeof(USED_MEM)); + DBUG_ENTER("alloc_root"); + DBUG_PRINT("enter",("root: %lx", mem_root)); + Size+=ALIGN_SIZE(sizeof(USED_MEM)); if (!(next = (USED_MEM*) my_malloc(Size,MYF(MY_WME)))) { if (mem_root->error_handler) (*mem_root->error_handler)(); - return((gptr) 0); /* purecov: inspected */ + DBUG_RETURN((gptr) 0); /* purecov: inspected */ } next->next= mem_root->used; next->size= Size; mem_root->used= next; - return (gptr) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM))); + DBUG_RETURN((gptr) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM)))); #else uint get_size, block_size; gptr point; @@ -151,8 +156,9 @@ void free_root(MEM_ROOT *root, myf MyFlags) { reg1 USED_MEM *next,*old; DBUG_ENTER("free_root"); + DBUG_PRINT("enter",("root: %lx flags: %u", root, (uint) MyFlags)); - if (!root) + if (!root) /* QQ: Should be deleted */ DBUG_VOID_RETURN; /* purecov: inspected */ if (MyFlags & MY_MARK_BLOCKS_FREE) { -- cgit v1.2.1