00001 /***************************************************************************** 00002 00003 Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it under 00006 the terms of the GNU General Public License as published by the Free Software 00007 Foundation; version 2 of the License. 00008 00009 This program is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License along with 00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 00015 St, Fifth Floor, Boston, MA 02110-1301 USA 00016 00017 *****************************************************************************/ 00018 00019 /**************************************************/ 00026 #pragma once 00027 #ifndef mem0pool_h 00028 #define mem0pool_h 00029 00030 #include "univ.i" 00031 #include "os0file.h" 00032 #include "ut0lst.h" 00033 00035 typedef struct mem_area_struct mem_area_t; 00037 typedef struct mem_pool_struct mem_pool_t; 00038 00040 extern mem_pool_t* mem_comm_pool; 00041 00044 struct mem_area_struct{ 00045 ulint size_and_free; 00049 UT_LIST_NODE_T(mem_area_t) 00050 free_list; 00051 }; 00052 00054 #define MEM_AREA_EXTRA_SIZE (ut_calc_align(sizeof(struct mem_area_struct),\ 00055 UNIV_MEM_ALIGNMENT)) 00056 00057 /********************************************************************/ 00060 UNIV_INTERN 00061 mem_pool_t* 00062 mem_pool_create( 00063 /*============*/ 00064 ulint size); 00065 /********************************************************************/ 00067 UNIV_INTERN 00068 void 00069 mem_pool_free( 00070 /*==========*/ 00071 mem_pool_t* pool); 00072 /********************************************************************/ 00076 UNIV_INTERN 00077 void* 00078 mem_area_alloc( 00079 /*===========*/ 00080 ulint* psize, 00085 mem_pool_t* pool); 00086 /********************************************************************/ 00088 UNIV_INTERN 00089 void 00090 mem_area_free( 00091 /*==========*/ 00092 void* ptr, 00094 mem_pool_t* pool); 00095 /********************************************************************/ 00098 UNIV_INTERN 00099 ulint 00100 mem_pool_get_reserved( 00101 /*==================*/ 00102 mem_pool_t* pool); 00103 /********************************************************************/ 00106 UNIV_INTERN 00107 ibool 00108 mem_pool_validate( 00109 /*==============*/ 00110 mem_pool_t* pool); 00111 /********************************************************************/ 00113 UNIV_INTERN 00114 void 00115 mem_pool_print_info( 00116 /*================*/ 00117 FILE* outfile, 00118 mem_pool_t* pool); 00121 #ifndef UNIV_NONINL 00122 #include "mem0pool.ic" 00123 #endif 00124 00125 #endif