Memory Allocation in the MySQL Server
Posted rsapaper
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Memory Allocation in the MySQL Server相关的知识,希望对你有一定的参考价值。
https://dev.mysql.com/doc/internals/en/memory-allocation-mysql-server.html
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.
以上是关于Memory Allocation in the MySQL Server的主要内容,如果未能解决你的问题,请参考以下文章
[转]Under the covers: IAM chains and allocation units in SQL Server 2005
C, dynamically memory allocation
Native memory allocation (mmap) failed to map 142606336 bytes for committing reserved memory.