List:Commits« Previous MessageNext Message »
From:kpettersson Date:October 25 2007 2:16pm
Subject:bk commit into 5.0 tree (thek:1.2544) BUG#31347
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of thek. When thek does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-25 14:16:24+02:00, thek@adventure.(none) +1 -0
  Bug#31347 Increase in memory usage after many DROP USER statements
  
  Dropping users causes huge increase in memory usage because field values were
  allocated on the server memory root for temporary usage but never deallocated.
  
  This patch changes the target memory root to be that of the thread handler
  instead since this root is cleared between each statement.

  sql/sql_acl.cc@stripped, 2007-10-25 14:16:22+02:00, thek@adventure.(none) +7 -5
    Changed memory root from server life time memory to thread life time memory.

diff -Nrup a/sql/sql_acl.cc b/sql/sql_acl.cc
--- a/sql/sql_acl.cc	2007-09-20 18:10:34 +02:00
+++ b/sql/sql_acl.cc	2007-10-25 14:16:22 +02:00
@@ -4865,6 +4865,7 @@ static int handle_grant_table(TABLE_LIST
   byte user_key[MAX_KEY_LENGTH];
   uint key_prefix_length;
   DBUG_ENTER("handle_grant_table");
+  THD *thd= current_thd;
 
   if (! table_no) // mysql.user table
   {
@@ -4932,17 +4933,18 @@ static int handle_grant_table(TABLE_LIST
           DBUG_PRINT("info",("scan error: %d", error));
           continue;
         }
-        if (! (host= get_field(&mem, host_field)))
+        if (! (host= get_field(thd->mem_root, host_field)))
           host= "";
-        if (! (user= get_field(&mem, user_field)))
+        if (! (user= get_field(thd->mem_root, user_field)))
           user= "";
 
 #ifdef EXTRA_DEBUG
         DBUG_PRINT("loop",("scan fields: '%s'@'%s' '%s' '%s' '%s'",
                            user, host,
-                           get_field(&mem, table->field[1]) /*db*/,
-                           get_field(&mem, table->field[3]) /*table*/,
-                           get_field(&mem, table->field[4]) /*column*/));
+                           get_field(thd->mem_root, table->field[1]) /*db*/,
+                           get_field(thd->mem_root, table->field[3]) /*table*/,
+                           get_field(thd->mem_root,
+                                     table->field[4]) /*column*/));
 #endif
         if (strcmp(user_str, user) ||
             my_strcasecmp(system_charset_info, host_str, host))
Thread
bk commit into 5.0 tree (thek:1.2544) BUG#31347kpettersson25 Oct
  • Re: bk commit into 5.0 tree (thek:1.2544) BUG#31347Davi Arnaut30 Oct