MySQL 8.4.2
Source Code Documentation
jemalloc_win.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2021, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27#ifndef JEMALLOC_WIN_INCLUDED
28#define JEMALLOC_WIN_INCLUDED
29
30/** @file jemalloc_win.h
31 Details for dynamically loading and using jemalloc.dll on Windows */
32
33#ifdef _WIN32
34#include <mutex>
35#include <string>
36#include <vector>
37#include "mysql/my_loglevel.h"
38const constexpr char *jemalloc_dll_name = "jemalloc.dll";
39const constexpr char *jemalloc_malloc_function_name = "je_malloc";
40const constexpr char *jemalloc_calloc_function_name = "je_calloc";
41const constexpr char *jemalloc_realloc_function_name = "je_realloc";
42const constexpr char *jemalloc_free_function_name = "je_free";
43
44namespace mysys {
45extern bool is_my_malloc_using_jemalloc();
46struct LogMessageInfo {
47 loglevel m_severity;
48 int64_t m_ecode;
49 std::string m_message;
50};
51extern std::vector<LogMessageInfo> fetch_jemalloc_initialization_messages();
52
53const int64_t MY_MALLOC_USING_JEMALLOC_ER = 0;
54const int64_t MY_MALLOC_USING_STD_MALLOC_ER = 1;
55const int64_t MY_MALLOC_LOADLIBRARY_FAILED_ER = 2;
56const int64_t MY_MALLOC_GETPROCADDRESS_FAILED_ER = 3;
57
58namespace detail {
59extern void *(*pfn_malloc)(size_t size);
60extern void *(*pfn_calloc)(size_t number, size_t size);
61extern void *(*pfn_realloc)(void *ptr, size_t size);
62extern void (*pfn_free)(void *ptr);
63extern std::once_flag init_malloc_pointers_flag;
64void init_malloc_pointers();
65} // namespace detail
66} // namespace mysys
67
68#endif // _WIN32
69
70#endif // JEMALLOC_WIN_INCLUDED
Definition of the global "loglevel" enumeration.
loglevel
Definition: my_loglevel.h:41
Definition: ut0tuple.h:57
size_t size(const char *const c)
Definition: base64.h:46