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