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