drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
mem0pool.h File Reference
#include "univ.i"
#include "os0file.h"
#include "ut0lst.h"
Include dependency graph for mem0pool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mem_area_struct

Macros

#define mem0pool_h
#define MEM_AREA_EXTRA_SIZE

Typedefs

typedef struct mem_area_struct mem_area_t
typedef struct mem_pool_struct mem_pool_t

Functions

UNIV_INTERN mem_pool_t * mem_pool_create (ulint size)
UNIV_INTERN void mem_pool_free (mem_pool_t *pool)
UNIV_INTERN void * mem_area_alloc (ulint *psize, mem_pool_t *pool)
UNIV_INTERN void mem_area_free (void *ptr, mem_pool_t *pool)
UNIV_INTERN ulint mem_pool_get_reserved (mem_pool_t *pool)
UNIV_INTERN ibool mem_pool_validate (mem_pool_t *pool)
UNIV_INTERN void mem_pool_print_info (FILE *outfile, mem_pool_t *pool)

Variables

mem_pool_t * mem_comm_pool

Detailed Description

The lowest-level memory management

Created 6/9/1994 Heikki Tuuri

Definition in file mem0pool.h.

Macro Definition Documentation

◆ mem0pool_h

#define mem0pool_h

Definition at line 28 of file mem0pool.h.

◆ MEM_AREA_EXTRA_SIZE

#define MEM_AREA_EXTRA_SIZE
Value:
(ut_calc_align(sizeof(struct mem_area_struct),\
UNIV_MEM_ALIGNMENT))
#define ut_calc_align(n, m)
Definition ut0ut.h:187

Each memory area takes this many extra bytes for control information

Definition at line 54 of file mem0pool.h.

Typedef Documentation

◆ mem_area_t

typedef struct mem_area_struct mem_area_t

Memory area header

Definition at line 35 of file mem0pool.h.

◆ mem_pool_t

typedef struct mem_pool_struct mem_pool_t

Memory pool

Definition at line 37 of file mem0pool.h.

Function Documentation

◆ mem_area_alloc()

UNIV_INTERN void * mem_area_alloc ( ulint * psize,
mem_pool_t * pool )

Allocates memory from a pool. NOTE: This low-level function should only be used in mem0mem.*!

Returns
own: allocated memory buffer in: memory pool

Allocates memory from a pool. NOTE: This low-level function should only be used in mem0mem.*!

Returns
own: allocated memory buffer
Parameters
psizein: requested size in bytes; for optimum space usage, the size should be a power of 2 minus MEM_AREA_EXTRA_SIZE; out: allocated size in bytes (greater than or equal to the requested size)
poolin: memory pool

Definition at line 368 of file mem0pool.cc.

◆ mem_area_free()

UNIV_INTERN void mem_area_free ( void * ptr,
mem_pool_t * pool )

Frees memory to a pool. in: memory pool

Frees memory to a pool.

Parameters
ptrin, own: pointer to allocated memory buffer
poolin: memory pool

Definition at line 510 of file mem0pool.cc.

◆ mem_pool_create()

UNIV_INTERN mem_pool_t * mem_pool_create ( ulint size)

Creates a memory pool.

Returns
memory pool in: pool size in bytes

Creates a memory pool.

Returns
memory pool
Parameters
sizein: pool size in bytes

Definition at line 220 of file mem0pool.cc.

◆ mem_pool_free()

UNIV_INTERN void mem_pool_free ( mem_pool_t * pool)

Frees a memory pool. in, own: memory pool

Frees a memory pool.

Parameters
poolin, own: memory pool

Definition at line 283 of file mem0pool.cc.

◆ mem_pool_get_reserved()

UNIV_INTERN ulint mem_pool_get_reserved ( mem_pool_t * pool)

Returns the amount of reserved memory.

Returns
reserved mmeory in bytes in: memory pool

Returns the amount of reserved memory.

Returns
reserved memory in bytes
Parameters
poolin: memory pool

Definition at line 720 of file mem0pool.cc.

◆ mem_pool_print_info()

UNIV_INTERN void mem_pool_print_info ( FILE * outfile,
mem_pool_t * pool )

Prints info of a memory pool. in: memory pool

Prints info of a memory pool.

Parameters
outfilein: output file to write to
poolin: memory pool

Definition at line 686 of file mem0pool.cc.

◆ mem_pool_validate()

UNIV_INTERN ibool mem_pool_validate ( mem_pool_t * pool)

Validates a memory pool.

Returns
TRUE if ok in: memory pool

Validates a memory pool.

Returns
TRUE if ok
Parameters
poolin: memory pool

Definition at line 640 of file mem0pool.cc.

Variable Documentation

◆ mem_comm_pool

mem_pool_t* mem_comm_pool
extern

The common memory pool

Definition at line 116 of file mem0pool.cc.