2
+----------------------------------------------------------------------+
4
+----------------------------------------------------------------------+
5
| Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
6
+----------------------------------------------------------------------+
7
| This source file is subject to version 2.00 of the Zend license, |
8
| that is bundled with this package in the file LICENSE, and is |
9
| available through the world-wide-web at the following url: |
10
| http://www.zend.com/license/2_00.txt. |
11
| If you did not receive a copy of the Zend license and are unable to |
12
| obtain it through the world-wide-web, please send a note to |
13
| license@zend.com so we can mail you a copy immediately. |
14
+----------------------------------------------------------------------+
15
| Authors: Andi Gutmans <andi@zend.com> |
16
| Zeev Suraski <zeev@zend.com> |
17
+----------------------------------------------------------------------+
20
/* $Id: zend_mm.h,v 1.18 2004/07/05 17:06:41 andi Exp $ */
25
#include <sys/types.h>
28
#include "zend_types.h"
39
typedef struct _zend_mm_block {
40
unsigned int size : 31;
41
unsigned int type : 1;
43
unsigned int guard_block : 1;
46
typedef struct _zend_mm_free_block {
47
unsigned int size : 31;
48
unsigned int type : 1;
50
struct _zend_mm_free_block *prev_free_block;
51
struct _zend_mm_free_block *next_free_block;
54
typedef struct _zend_mm_segment {
55
struct _zend_mm_segment *next_segment;
58
#define ZEND_MM_NUM_BUCKETS 16
60
#define ZEND_HEAP_MAX_BUCKETS ZEND_MM_NUM_BUCKETS
62
typedef int zend_heap[2*ZEND_HEAP_MAX_BUCKETS-1];
64
typedef struct _zend_mm_heap {
65
zend_mm_segment *segments_list;
67
zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS];
71
zend_bool zend_mm_startup(zend_mm_heap *heap, size_t block_size);
72
void zend_mm_shutdown(zend_mm_heap *heap);
73
void *zend_mm_alloc(zend_mm_heap *heap, size_t size);
74
void zend_mm_free(zend_mm_heap *heap, void *p);
75
void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size);
77
#endif /* _ZEND_MM_H */