MySQL 8.4.0
Source Code Documentation
thr_malloc.h
Go to the documentation of this file.
1/* Copyright (c) 2006, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef THR_MALLOC_INCLUDED
25#define THR_MALLOC_INCLUDED
26
27#include <stddef.h>
28
29struct CHARSET_INFO;
30struct MEM_ROOT;
31typedef unsigned int PSI_memory_key;
32extern thread_local MEM_ROOT **THR_MALLOC;
33
34void init_sql_alloc(PSI_memory_key key, MEM_ROOT *root, size_t block_size);
35
36void *sql_calloc(size_t);
37char *sql_strdup(const char *str);
38char *sql_strmake(const char *str, size_t len);
39void *sql_memdup(const void *ptr, size_t size);
40char *sql_strmake_with_convert(const char *str, size_t arg_length,
41 const CHARSET_INFO *from_cs,
42 size_t max_res_length, const CHARSET_INFO *to_cs,
43 size_t *result_length);
44
45#endif /* THR_MALLOC_INCLUDED */
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1073
size_t size(const char *const c)
Definition: base64.h:46
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Definition: m_ctype.h:423
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
void init_sql_alloc(PSI_memory_key key, MEM_ROOT *root, size_t block_size)
Definition: thr_malloc.cc:46
thread_local MEM_ROOT ** THR_MALLOC
Definition: mysqld.cc:1557
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:79
unsigned int PSI_memory_key
Definition: thr_malloc.h:30
void * sql_calloc(size_t)
Definition: thr_malloc.cc:51
void * sql_memdup(const void *ptr, size_t size)
Definition: thr_malloc.cc:73
char * sql_strmake(const char *str, size_t len)
Definition: thr_malloc.cc:64
char * sql_strdup(const char *str)
Definition: thr_malloc.cc:57