MySQL  8.0.17
Source Code Documentation
slabs.c File Reference
#include "config.h"
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <inttypes.h>
#include <stdarg.h>
#include "default_engine.h"

Functions

static int do_slabs_newslab (struct default_engine *engine, const unsigned int id)
 
static void * memory_allocate (struct default_engine *engine, size_t size)
 
unsigned int slabs_clsid (struct default_engine *engine, const size_t size)
 Given object size, return id to use when allocating/freeing memory for object 0 means error: can't store such a large object. More...
 
ENGINE_ERROR_CODE slabs_init (struct default_engine *engine, const size_t limit, const double factor, const bool prealloc)
 Determines the chunk sizes and initializes the slab class descriptors accordingly. More...
 
static int grow_slab_list (struct default_engine *engine, const unsigned int id)
 
static void * do_slabs_alloc (struct default_engine *engine, const size_t size, unsigned int id)
 
static void do_slabs_free (struct default_engine *engine, void *ptr, const size_t size, unsigned int id)
 
void add_statistics (const void *cookie, ADD_STAT add_stats, const char *prefix, int num, const char *key, const char *fmt,...)
 
static void do_slabs_stats (struct default_engine *engine, ADD_STAT add_stats, const void *cookie)
 
void * slabs_alloc (struct default_engine *engine, size_t size, unsigned int id)
 Allocate object of given length. More...
 
void slabs_free (struct default_engine *engine, void *ptr, size_t size, unsigned int id)
 Free previously allocated object. More...
 
void slabs_stats (struct default_engine *engine, ADD_STAT add_stats, const void *c)
 Fill buffer with stats. More...
 
void slabs_adjust_mem_requested (struct default_engine *engine, unsigned int id, size_t old, size_t ntotal)
 Adjust the stats for memory requested. More...
 

Function Documentation

◆ add_statistics()

void add_statistics ( const void *  cookie,
ADD_STAT  add_stats,
const char *  prefix,
int  num,
const char *  key,
const char *  fmt,
  ... 
)

◆ do_slabs_alloc()

static void* do_slabs_alloc ( struct default_engine engine,
const size_t  size,
unsigned int  id 
)
static

◆ do_slabs_free()

static void do_slabs_free ( struct default_engine engine,
void *  ptr,
const size_t  size,
unsigned int  id 
)
static

◆ do_slabs_newslab()

static int do_slabs_newslab ( struct default_engine engine,
const unsigned int  id 
)
static

◆ do_slabs_stats()

static void do_slabs_stats ( struct default_engine engine,
ADD_STAT  add_stats,
const void *  cookie 
)
static

◆ grow_slab_list()

static int grow_slab_list ( struct default_engine engine,
const unsigned int  id 
)
static

◆ memory_allocate()

static void * memory_allocate ( struct default_engine engine,
size_t  size 
)
static

◆ slabs_adjust_mem_requested()

void slabs_adjust_mem_requested ( struct default_engine engine,
unsigned int  id,
size_t  old,
size_t  ntotal 
)

Adjust the stats for memory requested.

◆ slabs_alloc()

void* slabs_alloc ( struct default_engine engine,
const size_t  size,
unsigned int  id 
)

Allocate object of given length.

0 on error

◆ slabs_clsid()

unsigned int slabs_clsid ( struct default_engine engine,
const size_t  size 
)

Given object size, return id to use when allocating/freeing memory for object 0 means error: can't store such a large object.

◆ slabs_free()

void slabs_free ( struct default_engine engine,
void *  ptr,
size_t  size,
unsigned int  id 
)

Free previously allocated object.

◆ slabs_init()

ENGINE_ERROR_CODE slabs_init ( struct default_engine engine,
const size_t  limit,
const double  factor,
const bool  prealloc 
)

Determines the chunk sizes and initializes the slab class descriptors accordingly.

Init the subsystem.

◆ slabs_stats()

void slabs_stats ( struct default_engine engine,
ADD_STAT  add_stats,
const void *  c 
)

Fill buffer with stats.