diff options
Diffstat (limited to 'storage/xtradb/include/mem0pool.h')
-rw-r--r-- | storage/xtradb/include/mem0pool.h | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/storage/xtradb/include/mem0pool.h b/storage/xtradb/include/mem0pool.h index 7e51b07bfe0..18f988241d6 100644 --- a/storage/xtradb/include/mem0pool.h +++ b/storage/xtradb/include/mem0pool.h @@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/****************************************************** +/**************************************************//** +@file include/mem0pool.h The lowest-level memory management Created 6/9/1994 Heikki Tuuri @@ -29,94 +30,96 @@ Created 6/9/1994 Heikki Tuuri #include "os0file.h" #include "ut0lst.h" +/** Memory area header */ typedef struct mem_area_struct mem_area_t; +/** Memory pool */ typedef struct mem_pool_struct mem_pool_t; -/* The common memory pool */ +/** The common memory pool */ extern mem_pool_t* mem_comm_pool; -/* Memory area header */ +/** Memory area header */ struct mem_area_struct{ - ulint size_and_free; /* memory area size is obtained by + ulint size_and_free; /*!< memory area size is obtained by anding with ~MEM_AREA_FREE; area in a free list if ANDing with MEM_AREA_FREE results in nonzero */ UT_LIST_NODE_T(mem_area_t) - free_list; /* free list node */ + free_list; /*!< free list node */ }; -/* Each memory area takes this many extra bytes for control information */ +/** Each memory area takes this many extra bytes for control information */ #define MEM_AREA_EXTRA_SIZE (ut_calc_align(sizeof(struct mem_area_struct),\ UNIV_MEM_ALIGNMENT)) -/************************************************************************ -Creates a memory pool. */ +/********************************************************************//** +Creates a memory pool. +@return memory pool */ UNIV_INTERN mem_pool_t* mem_pool_create( /*============*/ - /* out: memory pool */ - ulint size); /* in: pool size in bytes */ -/************************************************************************ + ulint size); /*!< in: pool size in bytes */ +/********************************************************************//** Allocates memory from a pool. NOTE: This low-level function should only be -used in mem0mem.*! */ +used in mem0mem.*! +@return own: allocated memory buffer */ UNIV_INTERN void* mem_area_alloc( /*===========*/ - /* out, own: allocated memory buffer */ - ulint* psize, /* in: requested size in bytes; for optimum + ulint* 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) */ - mem_pool_t* pool); /* in: memory pool */ -/************************************************************************ + mem_pool_t* pool); /*!< in: memory pool */ +/********************************************************************//** Frees memory to a pool. */ UNIV_INTERN void mem_area_free( /*==========*/ - void* ptr, /* in, own: pointer to allocated memory + void* ptr, /*!< in, own: pointer to allocated memory buffer */ - mem_pool_t* pool); /* in: memory pool */ -/************************************************************************ -Returns the amount of reserved memory. */ + mem_pool_t* pool); /*!< in: memory pool */ +/********************************************************************//** +Returns the amount of reserved memory. +@return reserved mmeory in bytes */ UNIV_INTERN ulint mem_pool_get_reserved( /*==================*/ - /* out: reserved mmeory in bytes */ - mem_pool_t* pool); /* in: memory pool */ -/************************************************************************ + mem_pool_t* pool); /*!< in: memory pool */ +/********************************************************************//** Reserves the mem pool mutex. */ UNIV_INTERN void mem_pool_mutex_enter(void); /*======================*/ -/************************************************************************ +/********************************************************************//** Releases the mem pool mutex. */ UNIV_INTERN void mem_pool_mutex_exit(void); /*=====================*/ -/************************************************************************ -Validates a memory pool. */ +/********************************************************************//** +Validates a memory pool. +@return TRUE if ok */ UNIV_INTERN ibool mem_pool_validate( /*==============*/ - /* out: TRUE if ok */ - mem_pool_t* pool); /* in: memory pool */ -/************************************************************************ + mem_pool_t* pool); /*!< in: memory pool */ +/********************************************************************//** Prints info of a memory pool. */ UNIV_INTERN void mem_pool_print_info( /*================*/ - FILE* outfile,/* in: output file to write to */ - mem_pool_t* pool); /* in: memory pool */ + FILE* outfile,/*!< in: output file to write to */ + mem_pool_t* pool); /*!< in: memory pool */ #ifndef UNIV_NONINL |