33#ifndef detail_ut_alloc_h 
   34#define detail_ut_alloc_h 
   75  template <
bool Zero_initialized>
 
   76  static inline void *
alloc(std::size_t 
size) 
noexcept {
 
   77    return Alloc_fn::alloc<Zero_initialized>(
size);
 
   88  static inline void *
realloc(
void *ptr, std::size_t 
size) 
noexcept {
 
  154                "metadata_len must be divisible by alignof(max_align_t)");
 
  162  template <
bool Zero_initialized>
 
  165    auto mem = Alloc_fn::alloc<Zero_initialized>(total_len);
 
  174  static inline void free(
void *ptr) 
noexcept {
 
  193  static inline void *
deduce(
void *ptr) 
noexcept {
 
  272  template <
bool Zero_initialized>
 
  276    auto mem = Alloc_fn::alloc<Zero_initialized>(total_len);
 
  279#ifdef HAVE_PSI_MEMORY_INTERFACE 
  317      return Alloc_pfs::alloc<false>(
size, 
key);
 
  326#ifdef HAVE_PSI_MEMORY_INTERFACE 
  333    (key_curr, datalen_curr, owner_curr);
 
  341#ifdef HAVE_PSI_MEMORY_INTERFACE 
  368#ifdef HAVE_PSI_MEMORY_INTERFACE 
  406template <
bool Pfs_memory_instrumentation_on, 
bool Array_specialization>
 
  420template <
bool Array_specialization>
 
  426template <
bool Pfs_memory_instrumentation_on, 
bool Array_specialization>
 
  429                                Array_specialization>
::type;
 
  434template <
typename Impl>
 
  436  template <
bool Zero_initialized, 
typename T = Impl>
 
  439    return Impl::template alloc<Zero_initialized>(
size, 
key);
 
  441  template <
bool Zero_initialized, 
typename T = Impl>
 
  444    return Impl::template alloc<Zero_initialized>(
size);
 
  446  template <
typename T = Impl>
 
  451  template <
typename T = Impl>
 
  457  static inline size_t datalen(
void *ptr) { 
return Impl::datalen(ptr); }
 
  458  template <
typename T = Impl>
 
  463  template <
typename T = Impl>
 
#define PSI_MEMORY_CALL(M)
Definition: psi_memory.h:36
 
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
 
#define realloc(P, A)
Definition: lexyy.cc:916
 
#define free(A)
Definition: lexyy.cc:915
 
Header for compiler-dependent features.
 
constexpr bool unlikely(bool expr)
Definition: my_compiler.h:58
 
Instrumentation helpers for memory allocation.
 
Definition: fts0fts.cc:237
 
size_t size(const char *const c)
Definition: base64.h:46
 
static PSI_memory_key memory_alloc(PSI_memory_key, size_t, struct PSI_thread **owner)
Definition: psi_memory_v2_empty.cc:35
 
static void memory_free(PSI_memory_key, size_t, struct PSI_thread *)
Definition: psi_memory_v2_empty.cc:53
 
constexpr size_t calc_align(size_t n, size_t m)
Calculates the smallest multiple of m that is not smaller than n when m is a power of two.
Definition: helper.h:45
 
typename select_malloc_impl< Pfs_memory_instrumentation_on, Array_specialization >::type select_malloc_impl_t
Just a small helper type which saves us some keystrokes.
Definition: alloc.h:429
 
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
 
required string key
Definition: replication_asynchronous_connection_failover.proto:60
 
required string type
Definition: replication_group_member_actions.proto:34
 
static MEM_ROOT mem
Definition: sql_servers.cc:100
 
Implementation bits and pieces for PFS metadata handling.
 
Small wrapper which utilizes SFINAE to dispatch the call to appropriate allocator implementation.
Definition: alloc.h:435
 
static void free(void *ptr)
Definition: alloc.h:456
 
static std::enable_if<!T::is_pfs_instrumented_v, void * >::type alloc(size_t size, PSI_memory_key)
Definition: alloc.h:443
 
static std::enable_if<!T::is_pfs_instrumented_v, void * >::type realloc(void *ptr, size_t size, PSI_memory_key)
Definition: alloc.h:453
 
static std::enable_if< T::is_pfs_instrumented_v, size_t >::type pfs_overhead()
Definition: alloc.h:460
 
static std::enable_if< T::is_pfs_instrumented_v, void * >::type realloc(void *ptr, size_t size, PSI_memory_key key)
Definition: alloc.h:448
 
static std::enable_if< T::is_pfs_instrumented_v, void * >::type alloc(size_t size, PSI_memory_key key)
Definition: alloc.h:438
 
static std::enable_if<!T::is_pfs_instrumented_v, size_t >::type pfs_overhead()
Definition: alloc.h:465
 
static size_t datalen(void *ptr)
Definition: alloc.h:457
 
Specialization of allocation routines for non-extended alignment types but which in comparison to All...
Definition: alloc.h:137
 
static void * deduce(void *ptr) noexcept
Helper function which deduces the original pointer returned by Alloc_arr::alloc() from a pointer whic...
Definition: alloc.h:193
 
static constexpr auto metadata_len
This is how much the metadata (ALLOC-ARR-META) segment will be big.
Definition: alloc.h:139
 
static void * alloc(std::size_t size) noexcept
Sanity check so that we can be sure that our metadata segment can fit the datalen_t.
Definition: alloc.h:163
 
size_t datalen_t
This is the type we will be using to store the size of an array.
Definition: alloc.h:142
 
static void free(void *ptr) noexcept
Releases storage dynamically allocated through Alloc_arr::alloc().
Definition: alloc.h:174
 
static datalen_t datalen(void *ptr)
Returns the size of an array in bytes.
Definition: alloc.h:185
 
static void free(void *ptr)
Definition: allocator_traits.h:105
 
static void * realloc(void *ptr, size_t nbytes)
Definition: allocator_traits.h:101
 
Allocation routines for non-extended alignment types, as opposed to Aligned_alloc_pfs for example,...
Definition: alloc.h:255
 
static void * realloc(PFS_metadata::data_segment_ptr data, std::size_t size, pfs_metadata::pfs_memory_key_t key)
Reallocates the given area of memory, which if not nullptr, must be previously allocated by Alloc_pfs...
Definition: alloc.h:312
 
static void free(PFS_metadata::data_segment_ptr data) noexcept
Releases storage dynamically allocated through Alloc_pfs::alloc().
Definition: alloc.h:365
 
static constexpr auto metadata_len
This is how much the metadata (PFS-META | VARLEN | PFS-META-OFFSET) segment will be big.
Definition: alloc.h:261
 
static size_t datalen(PFS_metadata::data_segment_ptr data)
Returns the number of bytes requested to be allocated.
Definition: alloc.h:390
 
static void * deduce(PFS_metadata::data_segment_ptr data) noexcept
Helper function which deduces the original pointer returned by Alloc_pfs::alloc() from a pointer whic...
Definition: alloc.h:398
 
static void * alloc(std::size_t size, pfs_metadata::pfs_memory_key_t key)
Dynamically allocates storage of given size at the address aligned to the requested alignment.
Definition: alloc.h:273
 
Allocation routines for non-extended alignment types, as opposed to Aligned_alloc for example.
Definition: alloc.h:68
 
static void * alloc(std::size_t size) noexcept
Dynamically allocates storage of given size.
Definition: alloc.h:76
 
static void free(void *ptr) noexcept
Releases storage dynamically allocated through Alloc::alloc() or Alloc::realloc().
Definition: alloc.h:98
 
static void * realloc(void *ptr, std::size_t size) noexcept
Reallocates the given area of memory.
Definition: alloc.h:88
 
Simple allocator traits.
Definition: allocator_traits.h:82
 
Simple utility metafunction which selects appropriate allocator variant (implementation) depending on...
Definition: alloc.h:407