summaryrefslogtreecommitdiff
path: root/mysys/safemalloc.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/nosik.monty.fi>2007-08-01 22:59:05 +0300
committerunknown <monty@mysql.com/nosik.monty.fi>2007-08-01 22:59:05 +0300
commit0c9a3e597d329c5475d4fec0a6f95ac87d65ca19 (patch)
treeea014474c5b5d34f211415d0a43cbc13631ccdfc /mysys/safemalloc.c
parentb59217ebbbb9c2869ab914805729b3ca57c976fa (diff)
downloadmariadb-git-0c9a3e597d329c5475d4fec0a6f95ac87d65ca19.tar.gz
Fixes Bug#30127: --debug-info no longer prints memory usage in mysql
Fixed compiler warnings, errors and link errors Fixed new bug on Solaris with gethrtime() Added --debug-check option to all mysql clients to print errors and memory leaks Added --debug-info to all clients. This now works as --debug-check but also prints memory and cpu usage BUILD/compile-solaris-sparc-debug: Remove old cpu options client/client_priv.h: Added OPT_DBUG_CHECK client/mysql.cc: --debug-info now prints memory usage Added --debug-check client/mysql_upgrade.c: --debug-info now prints memory usage Added --debug-check client/mysqladmin.cc: --debug-info now prints memory usage Added --debug-check client/mysqlbinlog.cc: --debug-info now prints memory usage Added --debug-check client/mysqlcheck.c: --debug-info now prints memory usage Added --debug-check client/mysqldump.c: --debug-info now prints memory usage Added --debug-check client/mysqlimport.c: --debug-info now prints memory usage Added --debug-check client/mysqlshow.c: --debug-info now prints memory usage Added --debug-check client/mysqlslap.c: --debug-info now prints memory usage Added --debug-check client/mysqltest.c: --debug-info now prints memory usage Added --debug-check include/my_sys.h: Added extra option to TERMINATE to not print statistics libmysql/libmysql.c: Fixed compiler warning mysql-test/mysql-test-run.pl: --debug-info -> --debug-check to not print memory usage mysys/my_getsystime.c: Moved fast time calculation to my_micro_time_and_time() Fixed bug in previous push related to HAVE_GETHRTIME mysys/my_init.c: Print not freed memory in my_end() if MY_CHECK_ERROR is given mysys/my_static.c: Cleanup mysys/safemalloc.c: Added extra option to TERMINATE to not print statistics sql/item_xmlfunc.cc: Fixed compiler warning sql/sql_test.cc: Fixed TERMINATE() call unittest/mysys/base64-t.c: Fixed link error unittest/mysys/bitmap-t.c: Fixed link error unittest/mysys/my_atomic-t.c: Fixed link error
Diffstat (limited to 'mysys/safemalloc.c')
-rw-r--r--mysys/safemalloc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 30c501c54ee..7a2f448b2dc 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -51,7 +51,7 @@
(equivalent to realloc())
FREE( pPtr ) Free memory allocated by NEW
(equivalent to free())
- TERMINATE(file) End system, report errors and stats on file
+ TERMINATE(file,flag) End system, report errors and stats on file
I personally use two more functions, but have not included them here:
char *STRSAVE( sPtr ) Save a copy of the string in dynamic memory
char *RENEW( pPtr, uSize )
@@ -352,12 +352,15 @@ static int check_ptr(const char *where, uchar *ptr, const char *filename,
/*
- TERMINATE(FILE *file)
- Report on all the memory pieces that have not been
- free'ed as well as the statistics.
+ Report on all the memory pieces that have not been free'ed
+
+ SYNOPSIS
+ TERMINATE()
+ file Write output to this file
+ flag If <> 0, also write statistics
*/
-void TERMINATE(FILE *file)
+void TERMINATE(FILE *file, uint flag)
{
struct st_irem *irem;
DBUG_ENTER("TERMINATE");
@@ -373,8 +376,7 @@ void TERMINATE(FILE *file)
{
if (file)
{
- fprintf(file, "Warning: Not freed memory segments: %u\n",
- sf_malloc_count);
+ fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count);
(void) fflush(file);
}
DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count));
@@ -414,7 +416,7 @@ void TERMINATE(FILE *file)
}
}
/* Report the memory usage statistics */
- if (file)
+ if (file && flag)
{
fprintf(file, "Maximum memory usage: %ld bytes (%ldk)\n",
sf_malloc_max_memory, (sf_malloc_max_memory + 1023L) / 1024L);