MySQL 8.0.29
Source Code Documentation
thr_malloc.h
Go to the documentation of this file.
1/* Copyright (c) 2006, 2022, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef THR_MALLOC_INCLUDED
24#define THR_MALLOC_INCLUDED
25
26#include <stddef.h>
27
28struct CHARSET_INFO;
29struct MEM_ROOT;
30typedef unsigned int PSI_memory_key;
31extern thread_local MEM_ROOT **THR_MALLOC;
32
33void init_sql_alloc(PSI_memory_key key, MEM_ROOT *root, size_t block_size);
34
35void *sql_calloc(size_t);
36char *sql_strdup(const char *str);
37char *sql_strmake(const char *str, size_t len);
38void *sql_memdup(const void *ptr, size_t size);
39char *sql_strmake_with_convert(const char *str, size_t arg_length,
40 const CHARSET_INFO *from_cs,
41 size_t max_res_length, const CHARSET_INFO *to_cs,
42 size_t *result_length);
43
44#endif /* THR_MALLOC_INCLUDED */
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:48
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1055
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Definition: m_ctype.h:354
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
void init_sql_alloc(PSI_memory_key key, MEM_ROOT *root, size_t block_size)
Definition: thr_malloc.cc:45
thread_local MEM_ROOT ** THR_MALLOC
Definition: mysqld.cc:1538
char * sql_strmake_with_convert(const char *str, size_t arg_length, const CHARSET_INFO *from_cs, size_t max_res_length, const CHARSET_INFO *to_cs, size_t *result_length)
Definition: thr_malloc.cc:78
unsigned int PSI_memory_key
Definition: thr_malloc.h:29
void * sql_calloc(size_t)
Definition: thr_malloc.cc:50
void * sql_memdup(const void *ptr, size_t size)
Definition: thr_malloc.cc:72
char * sql_strmake(const char *str, size_t len)
Definition: thr_malloc.cc:63
char * sql_strdup(const char *str)
Definition: thr_malloc.cc:56