MySQL 8.0.39
Source Code Documentation
my_memory.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 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#ifndef COMPONENT_MEMORY_H
24#define COMPONENT_MEMORY_H
25
26/**
27 @file components/library_mysys/my_memory.h
28*/
29
31
32/**
33 Below functions are used by the components. And these functions will
34 be in a static library(liblibrary_mysys.a) and the library is statically
35 linked whenever any component needs these function.
36*/
37
38#define MY_ZEROFILL 32 /** fill array with zero */
39
40/**
41 Allocates size bytes of memory.
42
43 @param key P_S key used for memory instrumentation
44 @param size size bytes to allocate the memory
45 @param flags used at the time of allocation. Could be @ref MY_ZEROFILL
46*/
47extern "C" void *my_malloc(PSI_memory_key key, size_t size, int flags);
48
49/**
50 Frees the memory pointed by the ptr.
51
52 @param ptr memory address to be freed
53*/
54extern "C" void my_free(void *ptr);
55#endif // COMPONENT_MEMORY_H
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
static int flags[50]
Definition: hp_test1.cc:40
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
Performance schema instrumentation interface.
required string key
Definition: replication_asynchronous_connection_failover.proto:60