https://dev.mysql.com/doc/internals/en/memory-allocation-mysql-server.html

MySQL Internals Manual  /  Memory Allocation  /  Memory Allocation in the MySQL Server (sql Directory)

9.1 Memory Allocation in the MySQL Server (sql Directory)

The basic logic to use:

All things that are used only for the duration of a query are allocated in THD::mem_root through sql_alloc() or thd->alloc() except:

  • Things that may grow, like string buffers of type String. See sql/sql_string.cc.

  • Large blocks of memory used in one state of the query that can be released early. These are things like sort buffers, range trees, etc.

  • Things in libraries that are outside of MySQL's control (like hash tables).

Things that are needed a longer time should be alllocated with my_malloc() or through another MEMROOT.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-07-04
  • 2021-06-09
  • 2021-07-02
  • 2021-11-05
  • 2021-10-07
猜你喜欢
  • 2021-10-14
  • 2021-11-20
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-06-17
  • 2021-09-08
相关资源
相似解决方案