27#ifndef TEMPTABLE_MEM_H 
   28#define TEMPTABLE_MEM_H 
   43#define _WIN32_WINNT 0x0601 
   51#define TEMPTABLE_USE_LINUX_NUMA 
   63#if defined(HAVE_WINNUMA) 
   64extern DWORD win_page_size;
 
  114  static void *
fetch(
size_t bytes);
 
  115  static void drop(
void *ptr, 
size_t bytes);
 
  118#ifdef TEMPTABLE_USE_LINUX_NUMA 
  147  static void *
fetch(
size_t bytes);
 
  148  static void drop(
void *ptr, 
size_t bytes);
 
  152#if defined(TEMPTABLE_USE_LINUX_NUMA) 
  153  if (linux_numa_available) {
 
  154    return numa_alloc_local(bytes);
 
  158#elif defined(HAVE_WINNUMA) 
  159  PROCESSOR_NUMBER processorNumber;
 
  161  GetCurrentProcessorNumberEx(&processorNumber);
 
  162  GetNumaProcessorNodeEx(&processorNumber, &numaNodeId);
 
  164      (bytes + win_page_size - 1) & ~(
static_cast<size_t>(win_page_size) - 1);
 
  165  return VirtualAllocExNuma(GetCurrentProcess(), 
nullptr, bytes,
 
  166                            MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE,
 
  175#if defined(TEMPTABLE_USE_LINUX_NUMA) 
  176  if (linux_numa_available) {
 
  177    numa_free(ptr, bytes);
 
  181#elif defined(HAVE_WINNUMA) 
  182  BOOL ret [[maybe_unused]] = VirtualFree(ptr, 0, MEM_RELEASE);
 
  190  DBUG_EXECUTE_IF(
"temptable_fetch_from_disk_return_null", 
return nullptr;);
 
  193  const int mode = _O_RDWR;
 
  195  const int mode = O_RDWR;
 
  212  void *ptr = 
my_mmap(
nullptr, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, f, 0);
 
  237  return (ptr == MAP_FAILED) ? 
nullptr : ptr;
 
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
 
int my_fallocator(File fd, my_off_t newlength, int filler, myf MyFlags)
Change size of the specified file.
Definition: my_fallocator.cc:71
 
my_off_t my_seek(File fd, my_off_t pos, int whence, myf MyFlags)
Seek to a position in a file.
Definition: my_seek.cc:69
 
File create_temp_file(char *to, const char *dir, const char *pfx, int mode, UnlinkOrKeepFile unlink_or_keep, myf MyFlags)
Definition: mf_tempfile.cc:219
 
#define my_mmap(a, b, c, d, e, f)
Definition: my_sys.h:842
 
#define MY_SEEK_SET
Definition: my_sys.h:167
 
#define MY_WME
Definition: my_sys.h:123
 
int my_close(File fd, myf MyFlags)
Close a file.
Definition: my_open.cc:99
 
#define my_munmap(a, b)
Definition: my_sys.h:846
 
@ UNLINK_FILE
Definition: my_sys.h:775
 
bool drop(THD *thd, const Table *tp)
Remove SDI for a table.
Definition: sdi.cc:639
 
#define malloc(A)
Definition: lexyy.cc:914
 
#define free(A)
Definition: lexyy.cc:915
 
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:171
 
#define MY_FILEPOS_ERROR
Definition: my_inttypes.h:73
 
#define MYF(v)
Definition: my_inttypes.h:97
 
Common #defines and includes for file and socket I/O.
 
#define FN_REFLEN
Definition: my_io.h:83
 
int File
Definition: my_io_bits.h:51
 
Common header for many mysys elements.
 
#define mysql_tmpdir
Definition: mysqld.h:702
 
Definition: aligned_atomic.h:44
 
static mysql_service_status_t fetch(const char *service_name, reference_caching_channel *out_channel) noexcept
Definition: component.cc:77
 
mode
Definition: file_handle.h:61
 
Definition: allocator.h:45
 
Source
Type of memory allocated.
Definition: memutils.h:68
 
@ MMAP_FILE
Memory is allocated on disk, using mmap()'ed file.
 
@ RAM
Memory is allocated from RAM, using malloc() for example.
 
TempTable auxiliary Result enum.
 
static void deallocate(void *ptr, size_t bytes)
Deallocates memory from MMAP-ed file.
Definition: memutils.h:144
 
static void * allocate(size_t bytes)
Allocates memory from MMAP-ed file.
Definition: memutils.h:132
 
static void * allocate(size_t bytes)
Allocates memory from RAM.
Definition: memutils.h:99
 
static void deallocate(void *ptr, size_t bytes)
Deallocates memory from RAM.
Definition: memutils.h:111
 
static const bool linux_numa_available
Set to true if Linux's numa_available() reports "available" (!= -1).
Definition: memutils.h:120
 
Primary-template (functor) class for memory-utils.
Definition: memutils.h:77
 
static void deallocate(void *ptr, size_t bytes)
 
static void * allocate(size_t bytes)