MySQL 5.6.14 Source Code Document
|
#include <stdlib.h>
Go to the source code of this file.
Classes | |
struct | st_mysql_lex_string |
struct | thd_alloc_service_st |
Typedefs | |
typedef struct st_mysql_lex_string | MYSQL_LEX_STRING |
Functions | |
void * | thd_alloc (MYSQL_THD thd, unsigned int size) |
void * | thd_calloc (MYSQL_THD thd, unsigned int size) |
char * | thd_strdup (MYSQL_THD thd, const char *str) |
char * | thd_strmake (MYSQL_THD thd, const char *str, unsigned int size) |
void * | thd_memdup (MYSQL_THD thd, const void *str, unsigned int size) |
MYSQL_LEX_STRING * | thd_make_lex_string (MYSQL_THD thd, MYSQL_LEX_STRING *lex_str, const char *str, unsigned int size, int allocate_lex_string) |
Variables | |
struct thd_alloc_service_st * | thd_alloc_service |
This service provdes functions to allocate memory in a connection local memory pool. The memory allocated there will be automatically freed at the end of the statement, don't use it for allocations that should live longer than that. For short living allocations this is more efficient than using my_malloc and friends, and automatic "garbage collection" allows not to think about memory leaks.
The pool is best for small to medium objects, don't use it for large allocations - they are better served with my_malloc.
Definition in file service_thd_alloc.h.
void* thd_alloc | ( | MYSQL_THD | thd, |
unsigned int | size | ||
) |
Allocate memory in the connection's local memory pool
When properly used in place of my_malloc()
, this can significantly improve concurrency. Don't use this or related functions to allocate large chunks of memory. Use for temporary storage only. The memory will be freed automatically at the end of the statement; no explicit code is required to prevent memory leaks.
Definition at line 1301 of file sql_class.cc.
void* thd_calloc | ( | MYSQL_THD | thd, |
unsigned int | size | ||
) |
Definition at line 1307 of file sql_class.cc.
MYSQL_LEX_STRING* thd_make_lex_string | ( | MYSQL_THD | thd, |
MYSQL_LEX_STRING * | lex_str, | ||
const char * | str, | ||
unsigned int | size, | ||
int | allocate_lex_string | ||
) |
Create a LEX_STRING in this connection's local memory pool
thd | user thread connection handle |
lex_str | pointer to LEX_STRING object to be initialized |
str | initializer to be copied into lex_str |
size | length of str, in bytes |
allocate_lex_string | flag: if TRUE, allocate new LEX_STRING object, instead of using lex_str value |
void* thd_memdup | ( | MYSQL_THD | thd, |
const void * | str, | ||
unsigned int | size | ||
) |
Definition at line 1334 of file sql_class.cc.
char* thd_strdup | ( | MYSQL_THD | thd, |
const char * | str | ||
) |
Definition at line 1313 of file sql_class.cc.
char* thd_strmake | ( | MYSQL_THD | thd, |
const char * | str, | ||
unsigned int | size | ||
) |
Definition at line 1319 of file sql_class.cc.