MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mem0mem.cc File Reference
#include "mem0mem.h"
#include "buf0buf.h"
#include "srv0srv.h"
#include "mem0dbg.cc"
#include <stdarg.h>
Include dependency graph for mem0mem.cc:

Go to the source code of this file.

Functions

UNIV_INTERN char * mem_heap_strdup (mem_heap_t *heap, const char *str)
UNIV_INTERN void * mem_heap_dup (mem_heap_t *heap, const void *data, ulint len)
UNIV_INTERN char * mem_heap_strcat (mem_heap_t *heap, const char *s1, const char *s2)
UNIV_INTERN char * mem_heap_printf (mem_heap_t *heap, const char *format,...)
UNIV_INTERN mem_block_tmem_heap_create_block (mem_heap_t *heap, ulint n, ulint type, const char *file_name, ulint line)
UNIV_INTERN mem_block_tmem_heap_add_block (mem_heap_t *heap, ulint n)
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)

Detailed Description

The memory management

Created 6/9/1994 Heikki Tuuri

Definition in file mem0mem.cc.

Function Documentation

UNIV_INTERN mem_block_t* mem_heap_add_block ( mem_heap_t heap,
ulint  n 
)

Adds a new block to a memory heap.

Returns
created block, NULL if did not succeed (only possible for MEM_HEAP_BTR_SEARCH type heaps)
Parameters
heapin: memory heap
nin: number of bytes user needs

Definition at line 416 of file mem0mem.cc.

Here is the call graph for this function:

UNIV_INTERN void mem_heap_block_free ( mem_heap_t heap,
mem_block_t block 
)

Frees a block from a memory heap.

Parameters
heapin: heap
blockin: block to free

Definition at line 469 of file mem0mem.cc.

Here is the call graph for this function:

UNIV_INTERN mem_block_t* mem_heap_create_block ( mem_heap_t heap,
ulint  n,
ulint  type,
const char *  file_name,
ulint  line 
)

Creates a memory heap block where data can be allocated.

Returns
own: memory heap block, NULL if did not succeed (only possible for MEM_HEAP_BTR_SEARCH type heaps)
Parameters
heapin: memory heap or NULL if first block should be created
nin: number of bytes needed for user data
typein: type of heap: MEM_HEAP_DYNAMIC or MEM_HEAP_BUFFER
file_namein: file name where created
linein: line where created

Definition at line 302 of file mem0mem.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void* mem_heap_dup ( mem_heap_t heap,
const void *  data,
ulint  len 
)

Duplicate a block of data, allocated from a memory heap.

Returns
own: a copy of the data
Parameters
heapin: memory heap where copy is allocated
datain: data to be copied
lenin: length of data, in bytes

Definition at line 119 of file mem0mem.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void mem_heap_free_block_free ( mem_heap_t heap)

Frees the free_block field from a memory heap.

Parameters
heapin: heap

Definition at line 542 of file mem0mem.cc.

Here is the call graph for this function:

UNIV_INTERN char* mem_heap_printf ( mem_heap_t heap,
const char *  format,
  ... 
)

A simple sprintf replacement that dynamically allocates the space for the formatted string from the given heap. This supports a very limited set of the printf syntax: types 's' and 'u' and length modifier 'l' (which is required for the 'u' type).

Returns
heap-allocated formatted string
Parameters
heapin: memory heap
formatin: format string

Definition at line 271 of file mem0mem.cc.

Here is the call graph for this function:

UNIV_INTERN char* mem_heap_strcat ( mem_heap_t heap,
const char *  s1,
const char *  s2 
)

Concatenate two strings and return the result, using a memory heap.

Returns
own: the result
Parameters
heapin: memory heap where string is allocated
s1in: string 1
s2in: string 2

Definition at line 133 of file mem0mem.cc.

Here is the call graph for this function:

UNIV_INTERN char* mem_heap_strdup ( mem_heap_t heap,
const char *  str 
)

Duplicates a NUL-terminated string, allocated from a memory heap.

Returns
own: a copy of the string
Parameters
heapin: memory heap where string is allocated
strin: string to be copied

Definition at line 106 of file mem0mem.cc.

Here is the call graph for this function:

Here is the caller graph for this function: