[Groonga-mysql-commit] mroonga/mroonga at c215671 [master] wrapper: fix a memory leak

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Oct 8 17:04:15 JST 2013


Kouhei Sutou	2013-10-08 17:04:15 +0900 (Tue, 08 Oct 2013)

  New Revision: c21567181bfb1b4b36da9368aadbb9c7a3f1fb97
  https://github.com/mroonga/mroonga/commit/c21567181bfb1b4b36da9368aadbb9c7a3f1fb97

  Message:
    wrapper: fix a memory leak
    
    TABLE_SHARE for wrapped handler should have its mutexes. Without this
    change, if wrapped handler uses its mutexes, they are not
    destroyed. It is a memory leak.
    
    MyISAM is a effected storage engine for the case. It uses these
    mutexes in ha_myisam::info().

  Modified files:
    mrn_table.cpp

  Modified: mrn_table.cpp (+8 -0)
===================================================================
--- mrn_table.cpp    2013-10-08 15:19:05 +0900 (59bd399)
+++ mrn_table.cpp    2013-10-08 17:04:15 +0900 (c1b5f14)
@@ -864,6 +864,10 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
       wrap_table_share->primary_key = share->wrap_primary_key;
       wrap_table_share->keys_in_use.init(share->wrap_keys);
       wrap_table_share->keys_for_keyread.init(share->wrap_keys);
+      mysql_mutex_init(key_TABLE_SHARE_LOCK_share,
+                       &(wrap_table_share->LOCK_share), MY_MUTEX_INIT_SLOW);
+      mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data,
+                       &(wrap_table_share->LOCK_ha_data), MY_MUTEX_INIT_FAST);
       share->wrap_table_share = wrap_table_share;
     }
 
@@ -910,6 +914,10 @@ int mrn_free_share(MRN_SHARE *share)
     mrn_free_share_alloc(share);
     thr_lock_delete(&share->lock);
     pthread_mutex_destroy(&share->mutex);
+    if (share->wrapper_mode) {
+      mysql_mutex_destroy(&(share->wrap_table_share->LOCK_share));
+      mysql_mutex_destroy(&(share->wrap_table_share->LOCK_ha_data));
+    }
     my_free(share, MYF(0));
   }
   DBUG_RETURN(0);
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-mysql-commit mailing list
Back to archive index