MySQL  8.0.28
Source Code Documentation
my_malloc.cc File Reference
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "memory_debugging.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_psi_config.h"
#include "my_sys.h"
#include "my_thread_local.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/psi/mysql_memory.h"
#include "mysql/psi/psi_memory.h"
#include "mysys_err.h"

Macros

#define USE_MALLOC_WRAPPER
 

Functions

static void * my_raw_malloc (size_t size, myf my_flags)
 Allocate a sized block of memory. More...
 
static void my_raw_free (void *ptr)
 Free memory allocated with my_raw_malloc. More...
 
void my_free (void *ptr)
 Frees the memory pointed by the ptr. More...
 
void * my_malloc (PSI_memory_key key, size_t size, myf flags)
 Allocates size bytes of memory. More...
 
void * my_realloc (PSI_memory_key key, void *ptr, size_t size, myf flags)
 
void my_claim (const void *ptr, bool claim)
 
void * my_memdup (PSI_memory_key key, const void *from, size_t length, myf my_flags)
 
char * my_strdup (PSI_memory_key key, const char *from, myf my_flags)
 
char * my_strndup (PSI_memory_key key, const char *from, size_t length, myf my_flags)
 

Macro Definition Documentation

◆ USE_MALLOC_WRAPPER

#define USE_MALLOC_WRAPPER

Function Documentation

◆ my_claim()

void my_claim ( const void *  ptr,
bool  claim 
)

◆ my_free()

void my_free ( void *  ptr)

Frees the memory pointed by the ptr.

Parameters
ptrmemory address to be freed

◆ my_malloc()

void* my_malloc ( PSI_memory_key  key,
size_t  size,
int  flags 
)

Allocates size bytes of memory.

Parameters
keyP_S key used for memory instrumentation
sizesize bytes to allocate the memory
flagsused at the time of allocation. Could be MY_ZEROFILL

◆ my_memdup()

void* my_memdup ( PSI_memory_key  key,
const void *  from,
size_t  length,
myf  my_flags 
)

◆ my_raw_free()

static void my_raw_free ( void *  ptr)
static

Free memory allocated with my_raw_malloc.

Remarks
Relies on free being able to handle a NULL argument.
Parameters
ptrPointer to the memory allocated by my_raw_malloc.

◆ my_raw_malloc()

static void * my_raw_malloc ( size_t  size,
myf  my_flags 
)
static

Allocate a sized block of memory.

Parameters
sizeThe size of the memory block in bytes.
my_flagsFailure action modifiers (bitmasks).
Returns
A pointer to the allocated memory block, or NULL on failure.

◆ my_realloc()

void* my_realloc ( PSI_memory_key  key,
void *  ptr,
size_t  size,
myf  flags 
)

◆ my_strdup()

char* my_strdup ( PSI_memory_key  key,
const char *  from,
myf  my_flags 
)

◆ my_strndup()

char* my_strndup ( PSI_memory_key  key,
const char *  from,
size_t  length,
myf  my_flags 
)