MySQL 8.4.2
Source Code Documentation
my_memory.cc File Reference
#include "mysql/components/library_mysys/my_memory.h"
#include <assert.h>
#include <stdlib.h>
#include "mysql/components/services/psi_memory.h"

Classes

struct  my_memory_header
 

Macros

#define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4)
 
#define MEM_FREELIKE_BLOCK(p1, p2)
 
#define HEADER_SIZE   32
 
#define MAGIC   1234
 
#define USER_TO_HEADER(P)   ((my_memory_header *)(((char *)P) - HEADER_SIZE))
 
#define HEADER_TO_USER(P)   (((char *)P) + HEADER_SIZE)
 

Typedefs

typedef struct my_memory_header my_memory_header
 

Functions

void * my_malloc (PSI_memory_key key, size_t size, int flags)
 Allocates size bytes of memory. More...
 
void my_free (void *ptr)
 Frees the memory pointed by the ptr. More...
 

Macro Definition Documentation

◆ HEADER_SIZE

#define HEADER_SIZE   32

◆ HEADER_TO_USER

#define HEADER_TO_USER (   P)    (((char *)P) + HEADER_SIZE)

◆ MAGIC

#define MAGIC   1234

◆ MEM_FREELIKE_BLOCK

#define MEM_FREELIKE_BLOCK (   p1,
  p2 
)
Value:
do { \
} while (0)

◆ MEM_MALLOCLIKE_BLOCK

#define MEM_MALLOCLIKE_BLOCK (   p1,
  p2,
  p3,
  p4 
)
Value:
do { \
} while (0)

◆ USER_TO_HEADER

#define USER_TO_HEADER (   P)    ((my_memory_header *)(((char *)P) - HEADER_SIZE))

Typedef Documentation

◆ my_memory_header

Function Documentation

◆ 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