What is a memory pool
(Memory Pool) is a way of allocating memories.
A memory pool is a request to allocate a certain number of memory blocks of equal size (in general) to be reserved before actually using memory. When there is a new memory requirement, a portion of the memory block is separated from the memory pool, and if the memory block is not enough, then continue to request new memory. One notable advantage of this is that the efficiency of memory allocation is improved.
There are a number of local memory allocations in the kernel that do not allow failures. As a way to ensure allocation in these cases, the kernel developer creates an abstraction known as a memory pool (or "Mempool"). A memory pool is really just a kind of fallback cache, and it tries to keep a list of free memory to use in an emergency.
Disadvantages of Malloc/free
Often we are used to request allocation of memory directly using APIs such as new and malloc, which are usually thread-safe, but the disadvantage of this is that due to the variable size of the requested memory block, a large amount of memory fragmentation is caused when used frequently and thus degrades performance (malloc/ The free function causes the user to switch between the state and the kernel, lock and unlock, and so on.
Incidentally, Mark. Good article: http://m.blog.csdn.net/blog/chhuach2005/23863625
Memory pool (thread pool) and Malloc/free