Go to the source code of this file.
Classes | |
struct | mem_area_struct |
Macros | |
#define | mem0pool_h |
#define | MEM_AREA_EXTRA_SIZE |
Typedefs | |
typedef struct mem_area_struct | mem_area_t |
typedef struct mem_pool_struct | mem_pool_t |
Functions | |
UNIV_INTERN mem_pool_t * | mem_pool_create (ulint size) |
UNIV_INTERN void | mem_pool_free (mem_pool_t *pool) |
UNIV_INTERN void * | mem_area_alloc (ulint *psize, mem_pool_t *pool) |
UNIV_INTERN void | mem_area_free (void *ptr, mem_pool_t *pool) |
UNIV_INTERN ulint | mem_pool_get_reserved (mem_pool_t *pool) |
UNIV_INTERN ibool | mem_pool_validate (mem_pool_t *pool) |
UNIV_INTERN void | mem_pool_print_info (FILE *outfile, mem_pool_t *pool) |
Variables | |
mem_pool_t * | mem_comm_pool |
#define MEM_AREA_EXTRA_SIZE |
Each memory area takes this many extra bytes for control information
Definition at line 54 of file mem0pool.h.
Referenced by mem_area_alloc(), mem_area_free(), and mem_pool_create().
typedef struct mem_area_struct mem_area_t |
Memory area header
Definition at line 35 of file mem0pool.h.
typedef struct mem_pool_struct mem_pool_t |
Memory pool
Definition at line 37 of file mem0pool.h.
UNIV_INTERN void* mem_area_alloc | ( | ulint * | psize, |
mem_pool_t * | pool | ||
) |
Allocates memory from a pool. NOTE: This low-level function should only be used in mem0mem.*!
Allocates memory from a pool. NOTE: This low-level function should only be used in mem0mem.*!
psize | in: requested size in bytes; for optimum space usage, the size should be a power of 2 minus MEM_AREA_EXTRA_SIZE; out: allocated size in bytes (greater than or equal to the requested size) |
pool | in: memory pool |
Definition at line 368 of file mem0pool.cc.
References mem_pool_struct::free_list, mem_analyze_corruption(), MEM_AREA_EXTRA_SIZE, mem_pool_validate(), mem_pool_struct::mutex, mem_pool_struct::reserved, mem_pool_struct::size, ut_2_exp(), ut_2_log(), ut_a, ut_ad, ut_error, UT_LIST_GET_FIRST, UT_LIST_GET_LEN, UT_LIST_REMOVE, ut_malloc(), and ut_max().
UNIV_INTERN void mem_area_free | ( | void * | ptr, |
mem_pool_t * | pool | ||
) |
Frees memory to a pool. in: memory pool
Frees memory to a pool.
ptr | in, own: pointer to allocated memory buffer |
pool | in: memory pool |
Definition at line 510 of file mem0pool.cc.
References mem_pool_struct::buf, mem_pool_struct::free_list, mem_analyze_corruption(), MEM_AREA_EXTRA_SIZE, mem_pool_validate(), mem_pool_struct::reserved, mem_pool_struct::size, ut_2_exp(), ut_2_log(), ut_a, ut_ad, ut_error, ut_free(), ut_is_2pow, UT_LIST_ADD_FIRST, and UT_LIST_REMOVE.
UNIV_INTERN mem_pool_t* mem_pool_create | ( | ulint | size | ) |
Creates a memory pool.
Creates a memory pool.
size | in: pool size in bytes |
Definition at line 220 of file mem0pool.cc.
References mem_pool_struct::buf, mem_pool_struct::free_list, MEM_AREA_EXTRA_SIZE, mem_pool_struct::mutex, mem_pool_struct::reserved, mem_pool_struct::size, ut_2_exp(), ut_2_log(), ut_ad, UT_LIST_ADD_FIRST, UT_LIST_INIT, ut_malloc(), and ut_malloc_low().
Referenced by mem_init().
UNIV_INTERN void mem_pool_free | ( | mem_pool_t * | pool | ) |
Frees a memory pool. in, own: memory pool
Frees a memory pool.
pool | in, own: memory pool |
Definition at line 283 of file mem0pool.cc.
References mem_pool_struct::buf, and ut_free().
Referenced by mem_close().
UNIV_INTERN ulint mem_pool_get_reserved | ( | mem_pool_t * | pool | ) |
Returns the amount of reserved memory.
Returns the amount of reserved memory.
pool | in: memory pool |
Definition at line 720 of file mem0pool.cc.
References mem_pool_struct::mutex, and mem_pool_struct::reserved.
Referenced by srv_printf_innodb_monitor().
UNIV_INTERN void mem_pool_print_info | ( | FILE * | outfile, |
mem_pool_t * | pool | ||
) |
Prints info of a memory pool. in: memory pool
Prints info of a memory pool.
outfile | in: output file to write to |
pool | in: memory pool |
Definition at line 686 of file mem0pool.cc.
References mem_pool_struct::free_list, mem_pool_validate(), mem_pool_struct::mutex, mem_pool_struct::reserved, mem_pool_struct::size, ut_2_exp(), and UT_LIST_GET_LEN.
UNIV_INTERN ibool mem_pool_validate | ( | mem_pool_t * | pool | ) |
Validates a memory pool.
Validates a memory pool.
pool | in: memory pool |
Definition at line 640 of file mem0pool.cc.
References mem_pool_struct::free_list, mem_pool_struct::reserved, mem_pool_struct::size, ut_2_exp(), ut_a, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and UT_LIST_VALIDATE.
Referenced by mem_area_alloc(), mem_area_free(), and mem_pool_print_info().
mem_pool_t* mem_comm_pool |
The common memory pool
Definition at line 116 of file mem0pool.cc.
Referenced by mem_close(), mem_init(), and srv_printf_innodb_monitor().