1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

BUG#11763882 - 56652: VALGRIND WARNINGS FOR MEMORY LEAK IN

ALTER TABLE AND/OR PLUGIN/SEMISYNC

If a plugin was uninstalled, thread local values for plugin
variables of string type with PLUGIN_VAR_MEMALLOC flag were
not freed.

With this patch these variables are freed when thread is
done (like all other variables).

sql/sql_class.h:
  Added variable which stores memory hunks allocated
  for PLUGIN_VAR_MEMALLOC values.
sql/sql_plugin.cc:
  Normally all memory allocated for dynamic variables values must
  be freed by cleanup_variables().
  
  But if a plugin was uninstalled, descriptors of it's system
  variables are lost. Still some memory may be occupied for thread
  local values. It is ok for most kinds of variables, as they're
  stored on dynamic_variables_ptr and freed when thread is done.
  
  Values for PLUGIN_VAR_MEMALLOC variables are stored separately.
  These lost values are handled by plugin_var_memalloc_free().
This commit is contained in:
Sergey Vojtovich
2011-11-10 10:43:34 +04:00
parent 4c7ece260e
commit cdb19df761
2 changed files with 167 additions and 45 deletions

View File

@ -410,8 +410,9 @@ typedef struct system_variables
*/
ulong dynamic_variables_version;
char* dynamic_variables_ptr;
uint dynamic_variables_head; /* largest valid variable offset */
uint dynamic_variables_size; /* how many bytes are in use */
uint dynamic_variables_head; /* largest valid variable offset */
uint dynamic_variables_size; /* how many bytes are in use */
LIST *dynamic_variables_allocs; /* memory hunks for PLUGIN_VAR_MEMALLOC */
ulonglong max_heap_table_size;
ulonglong tmp_table_size;