mirror of
https://github.com/MariaDB/server.git
synced 2026-05-02 21:25:36 +02:00
improvement in root memory allocator
This commit is contained in:
parent
862692cacf
commit
347ca5ea4e
2 changed files with 43 additions and 20 deletions
|
|
@ -21,6 +21,8 @@
|
|||
#ifndef _my_alloc_h
|
||||
#define _my_alloc_h
|
||||
|
||||
#define MAX_BLOCK_USAGE_BEFORE_DROP 10
|
||||
|
||||
typedef struct st_used_mem
|
||||
{ /* struct for once_alloc (block) */
|
||||
struct st_used_mem *next; /* Next block in use */
|
||||
|
|
@ -35,9 +37,14 @@ typedef struct st_mem_root
|
|||
USED_MEM *used; /* blocks almost without free memory */
|
||||
USED_MEM *pre_alloc; /* preallocated block */
|
||||
/* if block have less memory it will be put in 'used' list */
|
||||
unsigned int min_malloc;
|
||||
unsigned int block_size; /* initial block size */
|
||||
unsigned int block_num; /* allocated blocks counter */
|
||||
unsigned int min_malloc;
|
||||
unsigned int block_size; /* initial block size */
|
||||
unsigned int block_num; /* allocated blocks counter */
|
||||
/*
|
||||
first free block in queue test counter (if it exceed
|
||||
MAX_BLOCK_USAGE_BEFORE_DROP block will be droped in 'used' list)
|
||||
*/
|
||||
unsigned int first_block_usage;
|
||||
|
||||
void (*error_handler)(void);
|
||||
} MEM_ROOT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue