• Monty's avatar
    Fixed wrong assignment in calculate_block_sizes() for MEM_ROOT · e1a631fe
    Monty authored
    The effect was that that ROOT_FLAG_THREAD_SPECIFIC was cleared and
    the memory allocated by memroot would be contributed the the system,
    not to the thread.
    
    This exposed a bug in how "show explain for ..." allocated data.
    - The thread that did provide the explain allocated data in the
      "show explain" threads mem_root, which is marked as THREAD_SPECIFIC.
    - Fixed by allocating the explain data in a temporary explain_mem_root
      which is not THREAD_SPECIFIC.
    
    Other things:
    - Added extra checks when using update_malloc_size()
    - Do not call update_malloc_size() for memory not registered with
      update_malloc_size(). This avoid some wrong 'memory not freed' reports.
    - Added a checking of 'thd->killed' to ensure that
      main.truncate_notembedded.test still works.
    
    Reported by: Yury Chaikou
    e1a631fe
sql_show.cc 339 KB