For the complete documentation index, see llms.txt. This page is also available as Markdown.

THD Alloc Service

Plugin API reference: THD Alloc Service. Generated from the MariaDB server headers by doxygen and moxygen.

Plugin API / Services for Plugins / Plugin Services

This service provides 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.

Classes

Macros

Name
Description

Allocate memory in the connection's local memory pool

Create a LEX_STRING in this connection's local memory pool


thd_alloc

Defined in service_thd_alloc.h:95

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.


thd_calloc

Defined in service_thd_alloc.h:99

See also: thd_alloc()


thd_strdup

Defined in service_thd_alloc.h:103

See also: thd_alloc()


thd_strmake

Defined in service_thd_alloc.h:107

See also: thd_alloc()


thd_memdup

Defined in service_thd_alloc.h:112

See also: thd_alloc()


thd_make_lex_string

Defined in service_thd_alloc.h:127

Create a LEX_STRING in this connection's local memory pool

Returns

NULL on failure, or pointer to the LEX_STRING object

See also: thd_alloc()

Parameters

Parameter
Type
Description

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

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

Typedefs


MYSQL_CONST_LEX_STRING

Type: struct st_mysql_const_lex_string

Defined in service_thd_alloc.h:56


MYSQL_LEX_STRING

Type: struct st_mysql_lex_string

Defined in service_thd_alloc.h:70

Variables

Return
Name
Description

thd_alloc_service

Type: struct thd_alloc_service_st *

Defined in service_thd_alloc.h:81

Class Definitions

st_mysql_const_lex_string

Defined in service_thd_alloc.h:51

Public Attributes

Return
Name
Description

const char *

size_t


str

Defined in service_thd_alloc.h:53


length

Defined in service_thd_alloc.h:54

st_mysql_lex_string

Defined in service_thd_alloc.h:58

Public Attributes

Return
Name
Description

char *

size_t


str

Defined in service_thd_alloc.h:60


length

Defined in service_thd_alloc.h:61

Public Methods

Return
Name
Description

operator struct st_mysql_const_lex_string

const inline

Defined in service_thd_alloc.h:64

thd_alloc_service_st

Defined in service_thd_alloc.h:72

Public Attributes


thd_alloc_func

Defined in service_thd_alloc.h:73


thd_calloc_func

Defined in service_thd_alloc.h:74


thd_strdup_func

Defined in service_thd_alloc.h:75


thd_strmake_func

Defined in service_thd_alloc.h:76


thd_memdup_func

Defined in service_thd_alloc.h:77


thd_make_lex_string_func

Defined in service_thd_alloc.h:78

This page is licensed: GPLv2

spinner

Last updated

Was this helpful?