MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:holyfoot Date:January 31 2008 11:00am
Subject:bk commit into 4.1 tree (holyfoot:1.2705) BUG#33796
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf 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, 2008-01-31 15:00:52+04:00, holyfoot@stripped +2 -0
  Bug #33796 Memory leak for prepared statements in embedded server.
  
  Field data for a query was stored to the stmt->alloc that is emptied
  with mysql_stmt_close statement only. That means a lot of memory can
  be occupied without a reason if used doesn't call mysql_stmt_close often.

  libmysql/libmysql.c@stripped, 2008-01-31 15:00:51+04:00, holyfoot@stripped +5 -8
    Bug #33796 Memory leak for prepared statements in embedded server.
    
    Clean up result->alloc even if there's no 'data' created

  libmysqld/lib_sql.cc@stripped, 2008-01-31 15:00:51+04:00, holyfoot@stripped +1 -1
    Bug #33796 Memory leak for prepared statements in embedded server.
    
    alloc 'fields' in the 'result.alloc' as the 'mem_root' is only cleaned with
    'mysql_stmt_close'

diff -Nrup a/libmysql/libmysql.c b/libmysql/libmysql.c
--- a/libmysql/libmysql.c	2006-11-29 03:39:11 +04:00
+++ b/libmysql/libmysql.c	2008-01-31 15:00:51 +04:00
@@ -4522,14 +4522,11 @@ my_bool STDCALL mysql_stmt_free_result(M
   {
     MYSQL *mysql= stmt->mysql;
 
-    if (result->data)
-    {
-      /* Result buffered */
-      free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
-      result->data= NULL;
-      result->rows= 0;
-      stmt->data_cursor= NULL;
-    }
+    /* Result buffered */
+    free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
+    result->data= NULL;
+    result->rows= 0;
+    stmt->data_cursor= NULL;
 
     if (mysql && stmt->field_count &&
         (int) stmt->state > (int) MYSQL_STMT_PREPARE_DONE)
diff -Nrup a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
--- a/libmysqld/lib_sql.cc	2007-06-08 20:02:45 +05:00
+++ b/libmysqld/lib_sql.cc	2008-01-31 15:00:51 +04:00
@@ -668,7 +668,7 @@ bool Protocol::send_fields(List<Item> *l
     DBUG_RETURN(0);
 
   field_count= list->elements;
-  field_alloc= thd->current_stmt ? &thd->current_stmt->mem_root :
+  field_alloc= thd->current_stmt ? &thd->current_stmt->result.alloc :
                                    &mysql->field_alloc;
   if (!(client_field= mysql->fields= 
 	(MYSQL_FIELD *)alloc_root(field_alloc, 
Thread
bk commit into 4.1 tree (holyfoot:1.2705) BUG#33796holyfoot31 Jan
  • Re: bk commit into 4.1 tree (holyfoot:1.2705) BUG#33796Sergei Golubchik8 Feb