summaryrefslogtreecommitdiff
path: root/mysys/safemalloc.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/narttu.mysql.fi>2007-06-09 14:52:17 +0300
committerunknown <monty@mysql.com/narttu.mysql.fi>2007-06-09 14:52:17 +0300
commitfdfb51484c9b1e239fd9eb738051020967c99c7f (patch)
treecf92f9d802e5a9debd930bebc56f835d598aa6e3 /mysys/safemalloc.c
parente30e21f070b998a0a932f2dbc4da91e05108045a (diff)
downloadmariadb-git-fdfb51484c9b1e239fd9eb738051020967c99c7f.tar.gz
Fixed compiler warnings
Fixed bug in ma_dbug.c that gave valgrind warning (only relevant when using --debug) Fixed bug in blob logging (Fixes valgrind warning) maria_getint() -> maria_data_on_page() mysys/safemalloc.c: Added debug function to print out where a piece of memory was allocated sql/opt_range.cc: Remove DBUG_PRINT of unitailized memory storage/maria/ma_blockrec.c: Fixed bug in blob logging storage/maria/ma_check.c: Fixed compiler warning storage/maria/ma_dbug.c: Added missed end++; Caused usage of unitialized memory for nullable keys that was not NULL storage/maria/ma_delete.c: maria_getint() -> maria_data_on_page() storage/maria/ma_init.c: Added header file to get rid of warning storage/maria/ma_key.c: More debugging storage/maria/ma_loghandler.c: Removed some wrong ';' to get rid of compiler errors when compiling without debugging Indentation fixes Removed not needed 'break's Fixed some compiler warnings Added code to detect logging of unitialized memory storage/maria/ma_page.c: maria_getint() -> maria_data_on_page() Clear rest of index page before writing when used with valgrind (Fixes warning of writing pages with unitialized data) storage/maria/ma_range.c: maria_getint() -> maria_data_on_page() storage/maria/ma_rt_index.c: maria_getint() -> maria_data_on_page() storage/maria/ma_rt_index.h: maria_getint() -> maria_data_on_page() storage/maria/ma_rt_key.c: maria_getint() -> maria_data_on_page() storage/maria/ma_rt_split.c: maria_getint() -> maria_data_on_page() storage/maria/ma_search.c: maria_getint() -> maria_data_on_page() storage/maria/ma_test1.c: Fixed compiler warning storage/maria/ma_write.c: maria_getint() -> maria_data_on_page() storage/maria/maria_chk.c: maria_getint() -> maria_data_on_page() storage/maria/maria_def.h: maria_getint() -> maria_data_on_page() storage/maria/unittest/ma_pagecache_consist.c: Fixed compiler warning storage/maria/unittest/ma_pagecache_single.c: Fixed compiler warning storage/maria/unittest/ma_test_loghandler-t.c: Fixed compiler warning storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Fixed compiler warning storage/maria/unittest/ma_test_loghandler_multithread-t.c: Fixed compiler warning storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Fixed compiler warning storage/myisam/mi_dbug.c: Added missed end++; Caused usage of unitialized memory for nullable keys that was not NULL
Diffstat (limited to 'mysys/safemalloc.c')
-rw-r--r--mysys/safemalloc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index da15b02345b..5ab6d0dda0d 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -428,6 +428,29 @@ void TERMINATE(FILE *file)
}
+/*
+ Report where a piece of memory was allocated
+
+ This is usefull to call from withing a debugger
+*/
+
+
+void sf_malloc_report_allocated(void *memory)
+{
+ struct st_irem *irem;
+ for (irem= sf_malloc_root ; irem ; irem=irem->next)
+ {
+ char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
+ sf_malloc_prehunc);
+ if (data <= (char*) memory && (char*) memory <= data + irem->datasize)
+ {
+ printf("%u bytes at 0x%lx, allocated at line %u in '%s'\n",
+ irem->datasize, (long) data, irem->linenum, irem->filename);
+ break;
+ }
+ }
+}
+
/* Returns 0 if chunk is ok */
static int _checkchunk(register struct st_irem *irem, const char *filename,