Eneboo - Documentación para desarrolladores
src/libmysql_std/include/my_alloc.h
Ir a la documentación de este archivo.
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00015 
00016 /* 
00017    Data structures for mysys/my_alloc.c (root memory allocator)
00018 */
00019 
00020 #ifndef _my_alloc_h
00021 #define _my_alloc_h
00022 
00023 #define ALLOC_MAX_BLOCK_TO_DROP                 4096
00024 #define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP       10
00025 
00026 typedef struct st_used_mem
00027 {                                  /* struct for once_alloc (block) */
00028   struct st_used_mem *next;        /* Next block in use */
00029   unsigned int  left;              /* memory left in block  */
00030   unsigned int  size;              /* size of block */
00031 } USED_MEM;
00032 
00033 
00034 typedef struct st_mem_root
00035 {
00036   USED_MEM *free;                  /* blocks with free memory in it */
00037   USED_MEM *used;                  /* blocks almost without free memory */
00038   USED_MEM *pre_alloc;             /* preallocated block */
00039   /* if block have less memory it will be put in 'used' list */
00040   unsigned int min_malloc;
00041   unsigned int block_size;         /* initial block size */
00042   unsigned int block_num;          /* allocated blocks counter */
00043   /* 
00044      first free block in queue test counter (if it exceed 
00045      MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list)
00046   */
00047   unsigned int first_block_usage;
00048 
00049   void (*error_handler)(void);
00050 } MEM_ROOT;
00051 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'