From 9ec19b9b41804d8d4491f0f58ac06ae417e02ffa Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 1 Nov 2017 20:28:36 +0200 Subject: Reducing memory when using information schema The background is that one user had a lot of views and using some complex queries on information schema temporary memory of more than 2G was used. - Added new element 'total_alloc' to MEM_ROOT for easier debugging. - Added MAX_MEMORY_USED to information_schema.processlist. - Added new status variable "Memory_used_initial" that shows how much MariaDB uses at startup. This gives the base value for "Memory_used". - Reuse memory continuously for information schema queries instead of only freeing memory at query end. Other things - Removed some not needed set_notnull() calls for not null columns. --- sql/sql_const.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sql/sql_const.h') diff --git a/sql/sql_const.h b/sql/sql_const.h index a5756aa1f39..007b7faeebb 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -175,6 +175,11 @@ #define TABLE_ALLOC_BLOCK_SIZE 1024 #define WARN_ALLOC_BLOCK_SIZE 2048 #define WARN_ALLOC_PREALLOC_SIZE 1024 +/* + Note that if we are using 32K or less, then TCmalloc will use a local + heap without locks! +*/ +#define SHOW_ALLOC_BLOCK_SIZE (32768-MALLOC_OVERHEAD) /* The following parameters is to decide when to use an extra cache to -- cgit v1.2.1