InnoDB Plugin
1.0
|
Macros | |
#define | mem_heap_create_block(heap, n, type, file_name, line) mem_heap_create_block_func(heap, n, file_name, line, type) |
#define | mem_heap_create_at(N, file_name, line) mem_heap_create_func(N, file_name, line, MEM_HEAP_DYNAMIC) |
Functions | |
UNIV_INTERN mem_block_t * | mem_heap_create_block_func (mem_heap_t *heap, ulint n, const char *file_name, ulint line, ulint type) |
UNIV_INTERN void | mem_heap_block_free (mem_heap_t *heap, mem_block_t *block) |
UNIV_INTERN void | mem_heap_free_block_free (mem_heap_t *heap) |
UNIV_INTERN mem_block_t * | mem_heap_add_block (mem_heap_t *heap, ulint n) |
UNIV_INLINE void | mem_block_set_len (mem_block_t *block, ulint len) |
UNIV_INLINE ulint | mem_block_get_len (mem_block_t *block) |
UNIV_INLINE void | mem_block_set_type (mem_block_t *block, ulint type) |
UNIV_INLINE ulint | mem_block_get_type (mem_block_t *block) |
UNIV_INLINE void | mem_block_set_free (mem_block_t *block, ulint free) |
UNIV_INLINE ulint | mem_block_get_free (mem_block_t *block) |
UNIV_INLINE void | mem_block_set_start (mem_block_t *block, ulint start) |
UNIV_INLINE ulint | mem_block_get_start (mem_block_t *block) |
UNIV_INLINE void * | mem_heap_zalloc (mem_heap_t *heap, ulint n) |
UNIV_INLINE void * | mem_heap_alloc (mem_heap_t *heap, ulint n) |
UNIV_INLINE byte * | mem_heap_get_heap_top (mem_heap_t *heap) |
UNIV_INLINE void | mem_heap_free_heap_top (mem_heap_t *heap, byte *old_top) |
UNIV_INLINE void | mem_heap_empty (mem_heap_t *heap) |
UNIV_INLINE void * | mem_heap_get_top (mem_heap_t *heap, ulint n) |
UNIV_INLINE void | mem_heap_free_top (mem_heap_t *heap, ulint n) |
UNIV_INLINE mem_heap_t * | mem_heap_create_func (ulint n, const char *file_name, ulint line, ulint type) |
UNIV_INLINE void | mem_heap_free_func (mem_heap_t *heap, const char *file_name) |
ut_ad (mem_heap_check(heap)) | |
if (heap->free_block) | |
while (block!=NULL) | |
UNIV_INLINE void * | mem_alloc_func (ulint n, const char *file_name, ulint line, ulint *size) |
UNIV_INLINE void | mem_free_func (void *ptr, const char *file_name, ulint line) |
UNIV_INLINE ulint | mem_heap_get_size (mem_heap_t *heap) |
UNIV_INLINE char * | mem_strdup (const char *str) |
UNIV_INLINE char * | mem_strdupl (const char *str, ulint len) |
UNIV_INLINE char * | mem_heap_strdupl (mem_heap_t *heap, const char *str, ulint len) |
Variables | |
UNIV_INLINE void ulint line mem_block_t * | block = UT_LIST_GET_LAST(heap->base) |
mem_block_t * | prev_block |
The memory management
Created 6/8/1994 Heikki Tuuri
UNIV_INLINE void* mem_alloc_func | ( | ulint | n, |
const char * | file_name, | ||
ulint | line, | ||
ulint * | size | ||
) |
NOTE: Use the corresponding macro instead of this function. Allocates a single buffer of memory from the dynamic memory of the C compiler. Is like malloc of C. The buffer must be freed with mem_free.
n | in: desired number of bytes |
file_name | in: file name where created |
line | in: line where created |
size | out: allocated size in bytes, or NULL |
UNIV_INLINE void mem_free_func | ( | void * | ptr, |
const char * | file_name, | ||
ulint | line | ||
) |
NOTE: Use the corresponding macro instead of this function. Frees a single buffer of storage from the dynamic memory of the C compiler. Similar to the free of C.
ptr | in, own: buffer to be freed |
file_name | in: file name where created |
line | in: line where created |
UNIV_INTERN mem_block_t* mem_heap_add_block | ( | mem_heap_t * | heap, |
ulint | n | ||
) |
Adds a new block to a memory heap.
heap | in: memory heap |
UNIV_INLINE void* mem_heap_alloc | ( | mem_heap_t * | heap, |
ulint | n | ||
) |
Allocates n bytes of memory from a memory heap.
heap | in: memory heap |
n | in: number of bytes; if the heap is allowed to grow into the buffer pool, this must be <= MEM_MAX_ALLOC_IN_BUF |
UNIV_INTERN void mem_heap_block_free | ( | mem_heap_t * | heap, |
mem_block_t * | block | ||
) |
Frees a block from a memory heap. in: block to free
heap | in: heap |
UNIV_INTERN mem_block_t* mem_heap_create_block_func | ( | mem_heap_t * | heap, |
ulint | n, | ||
const char * | file_name, | ||
ulint | line, | ||
ulint | type | ||
) |
Creates a memory heap block where data can be allocated.
heap | in: memory heap or NULL if first block should be created |
n | in: number of bytes needed for user data |
file_name | in: file name where created |
line | in: line where created |
UNIV_INLINE mem_heap_t* mem_heap_create_func | ( | ulint | n, |
const char * | file_name, | ||
ulint | line, | ||
ulint | type | ||
) |
NOTE: Use the corresponding macros instead of this function. Creates a memory heap. For debugging purposes, takes also the file name and line as argument.
n | in: desired start block size, this means that a single user buffer of size n will fit in the block, 0 creates a default size block |
file_name | in: file name where created |
line | in: line where created |
type | in: heap type |
UNIV_INLINE void mem_heap_empty | ( | mem_heap_t * | heap | ) |
Empties a memory heap. The first memory block of the heap is not freed.
heap | in: heap to empty |
UNIV_INTERN void mem_heap_free_block_free | ( | mem_heap_t * | heap | ) |
Frees the free_block field from a memory heap. in: heap
UNIV_INLINE void mem_heap_free_func | ( | mem_heap_t * | heap, |
const char * | file_name | ||
) |
NOTE: Use the corresponding macro instead of this function. Frees the space occupied by a memory heap. In the debug version erases the heap memory blocks.
heap | in, own: heap to be freed |
UNIV_INLINE void mem_heap_free_heap_top | ( | mem_heap_t * | heap, |
byte * | old_top | ||
) |
Frees the space in a memory heap exceeding the pointer given. The pointer must have been acquired from mem_heap_get_heap_top. The first memory block of the heap is not freed.
heap | in: heap from which to free |
old_top | in: pointer to old top of heap |
UNIV_INLINE void mem_heap_free_top | ( | mem_heap_t * | heap, |
ulint | n | ||
) |
Frees the topmost element in a memory heap. The size of the element must be given.
heap | in: memory heap |
n | in: size of the topmost element |
UNIV_INLINE byte* mem_heap_get_heap_top | ( | mem_heap_t * | heap | ) |
Returns a pointer to the heap top.
heap | in: memory heap |
UNIV_INLINE ulint mem_heap_get_size | ( | mem_heap_t * | heap | ) |
Returns the space in bytes occupied by a memory heap.
heap | in: heap |
UNIV_INLINE void* mem_heap_get_top | ( | mem_heap_t * | heap, |
ulint | n | ||
) |
Returns a pointer to the topmost element in a memory heap. The size of the element must be given.
heap | in: memory heap |
n | in: size of the topmost element |
UNIV_INLINE char* mem_heap_strdupl | ( | mem_heap_t * | heap, |
const char * | str, | ||
ulint | len | ||
) |
Makes a NUL-terminated copy of a nonterminated string, allocated from a memory heap.
heap | in: memory heap where string is allocated |
str | in: string to be copied |
len | in: length of str, in bytes |
UNIV_INLINE void* mem_heap_zalloc | ( | mem_heap_t * | heap, |
ulint | n | ||
) |
Allocates and zero-fills n bytes of memory from a memory heap.
heap | in: memory heap |
n | in: number of bytes; if the heap is allowed to grow into the buffer pool, this must be <= MEM_MAX_ALLOC_IN_BUF |
UNIV_INLINE char* mem_strdup | ( | const char * | str | ) |
Duplicates a NUL-terminated string.
str | in: string to be copied |
UNIV_INLINE char* mem_strdupl | ( | const char * | str, |
ulint | len | ||
) |
Makes a NUL-terminated copy of a nonterminated string.
str | in: string to be copied |
len | in: length of str, in bytes |
block = UT_LIST_GET_LAST(heap->base) |
< in: file name where freed