summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2021-04-13 20:23:46 +0100
committerDaniel Black <daniel@mariadb.org>2021-04-14 19:21:35 +1000
commit9a3cbc05415dd862852dffbd368527319107f460 (patch)
tree8f9556308a6f0cd65b7bac4bf7193c6b37268f92 /sql/sql_test.cc
parent6c3e860cbf36831c118f6ea183acbbeb3c889bed (diff)
downloadmariadb-git-9a3cbc05415dd862852dffbd368527319107f460.tar.gz
mysqld: print status display subset of memory usage.bb-10.5-danielblack-pr1803-darwin-debug-memory
leveling up to some degree with linux's mallinfo* api for the memory usage display with debug build with malloc_zone Darwin api. Closes: #1803
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 36e4fedf835..6c1e5a2a578 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -33,6 +33,8 @@
#include <malloc.h>
#elif defined(HAVE_MALLINFO) && defined(HAVE_SYS_MALLOC_H)
#include <sys/malloc.h>
+#elif defined(HAVE_MALLOC_ZONE)
+#include <malloc/malloc.h>
#endif
#ifdef HAVE_EVENT_SCHEDULER
@@ -653,6 +655,20 @@ Memory allocated by threads: %s\n",
llstr(tmp.global_memory_used, llbuff[8]),
llstr(tmp.local_memory_used, llbuff[9]));
+#elif defined(HAVE_MALLOC_ZONE)
+ malloc_statistics_t info;
+ char llbuff[4][22];
+
+ malloc_zone_statistics(nullptr, &info);
+ printf("\nMemory status:\n\
+Total allocated space: %s\n\
+Total free space: %s\n\
+Global memory allocated by server: %s\n\
+Memory allocated by threads: %s\n",
+ llstr(info.size_allocated, llbuff[0]),
+ llstr((info.size_allocated - info.size_in_use), llbuff[1]),
+ llstr(tmp.global_memory_used, llbuff[2]),
+ llstr(tmp.local_memory_used, llbuff[3]));
#endif
#ifdef HAVE_EVENT_SCHEDULER