mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
d587a36aa1
be needed when testing production releases innobase/btr/btr0btr.c: Remove #ifdef UNIV_DEBUG around debug code innobase/buf/buf0buf.c: Remove #ifdef UNIV_DEBUG around debug code innobase/buf/buf0flu.c: Remove #ifdef UNIV_DEBUG around debug code innobase/buf/buf0lru.c: Remove #ifdef UNIV_DEBUG around debug code innobase/buf/buf0rea.c: Remove #ifdef UNIV_DEBUG around debug code innobase/data/data0type.c: Remove #ifdef UNIV_DEBUG around debug code innobase/dict/dict0dict.c: Remove #ifdef UNIV_DEBUG around debug code innobase/fsp/fsp0fsp.c: Remove #ifdef UNIV_DEBUG around debug code innobase/fut/fut0lst.c: Remove #ifdef UNIV_DEBUG around debug code innobase/ibuf/ibuf0ibuf.c: Remove #ifdef UNIV_DEBUG around debug code innobase/include/btr0btr.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/buf0buf.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/buf0buf.ic: Remove #ifdef UNIV_DEBUG around debug code innobase/include/buf0flu.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/buf0lru.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/data0type.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/dict0dict.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/fsp0fsp.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/fut0lst.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/lock0lock.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/mem0dbg.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/mem0dbg.ic: Remove #ifdef UNIV_DEBUG around debug code innobase/include/mem0pool.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/mtr0mtr.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/pars0opt.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/sync0rw.h: Remove #ifdef UNIV_DEBUG around debug code innobase/include/sync0sync.h: Remove #ifdef UNIV_DEBUG around debug code innobase/lock/lock0lock.c: Remove #ifdef UNIV_DEBUG around debug code innobase/mem/mem0dbg.c: Remove #ifdef UNIV_DEBUG around debug code innobase/mem/mem0pool.c: Remove #ifdef UNIV_DEBUG around debug code innobase/mtr/mtr0mtr.c: Remove #ifdef UNIV_DEBUG around debug code innobase/pars/pars0opt.c: Remove #ifdef UNIV_DEBUG around debug code innobase/srv/srv0start.c: Remove #ifdef UNIV_DEBUG around debug code innobase/sync/sync0rw.c: Remove #ifdef UNIV_DEBUG around debug code innobase/sync/sync0sync.c: Remove #ifdef UNIV_DEBUG around debug code innobase/trx/trx0roll.c: Remove #ifdef UNIV_DEBUG around debug code
108 lines
2.9 KiB
C
108 lines
2.9 KiB
C
/******************************************************
|
|
The lowest-level memory management
|
|
|
|
(c) 1994, 1995 Innobase Oy
|
|
|
|
Created 6/9/1994 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef mem0pool_h
|
|
#define mem0pool_h
|
|
|
|
#include "univ.i"
|
|
#include "os0file.h"
|
|
#include "ut0lst.h"
|
|
|
|
typedef struct mem_area_struct mem_area_t;
|
|
typedef struct mem_pool_struct mem_pool_t;
|
|
|
|
/* The common memory pool */
|
|
extern mem_pool_t* mem_comm_pool;
|
|
|
|
/* Memory area header */
|
|
|
|
struct mem_area_struct{
|
|
ulint size_and_free; /* memory area size is obtained by
|
|
anding with ~MEM_AREA_FREE; area in
|
|
a free list if ANDing with
|
|
MEM_AREA_FREE results in nonzero */
|
|
UT_LIST_NODE_T(mem_area_t)
|
|
free_list; /* free list node */
|
|
};
|
|
|
|
/* Each memory area takes this many extra bytes for control information */
|
|
#define MEM_AREA_EXTRA_SIZE (ut_calc_align(sizeof(struct mem_area_struct),\
|
|
UNIV_MEM_ALIGNMENT))
|
|
|
|
/************************************************************************
|
|
Creates a memory pool. */
|
|
|
|
mem_pool_t*
|
|
mem_pool_create(
|
|
/*============*/
|
|
/* out: memory pool */
|
|
ulint size); /* in: pool size in bytes */
|
|
/************************************************************************
|
|
Allocates memory from a pool. NOTE: This low-level function should only be
|
|
used in mem0mem.*! */
|
|
|
|
void*
|
|
mem_area_alloc(
|
|
/*===========*/
|
|
/* out, own: allocated memory buffer */
|
|
ulint size, /* in: allocated size in bytes; for optimum
|
|
space usage, the size should be a power of 2
|
|
minus MEM_AREA_EXTRA_SIZE */
|
|
mem_pool_t* pool); /* in: memory pool */
|
|
/************************************************************************
|
|
Frees memory to a pool. */
|
|
|
|
void
|
|
mem_area_free(
|
|
/*==========*/
|
|
void* ptr, /* in, own: pointer to allocated memory
|
|
buffer */
|
|
mem_pool_t* pool); /* in: memory pool */
|
|
/************************************************************************
|
|
Returns the amount of reserved memory. */
|
|
|
|
ulint
|
|
mem_pool_get_reserved(
|
|
/*==================*/
|
|
/* out: reserved mmeory in bytes */
|
|
mem_pool_t* pool); /* in: memory pool */
|
|
/************************************************************************
|
|
Reserves the mem pool mutex. */
|
|
|
|
void
|
|
mem_pool_mutex_enter(void);
|
|
/*======================*/
|
|
/************************************************************************
|
|
Releases the mem pool mutex. */
|
|
|
|
void
|
|
mem_pool_mutex_exit(void);
|
|
/*=====================*/
|
|
/************************************************************************
|
|
Validates a memory pool. */
|
|
|
|
ibool
|
|
mem_pool_validate(
|
|
/*==============*/
|
|
/* out: TRUE if ok */
|
|
mem_pool_t* pool); /* in: memory pool */
|
|
/************************************************************************
|
|
Prints info of a memory pool. */
|
|
|
|
void
|
|
mem_pool_print_info(
|
|
/*================*/
|
|
FILE* outfile,/* in: output file to write to */
|
|
mem_pool_t* pool); /* in: memory pool */
|
|
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "mem0pool.ic"
|
|
#endif
|
|
|
|
#endif
|