Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 251 lines (205 sloc) 12.104 kB
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
8775a37 @felipensp - Year++
felipensp authored
5 | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
573b460 @andigutmans Zend Library
andigutmans authored
6 +----------------------------------------------------------------------+
d863d52 Update headers.
Sebastian Bergmann authored
7 | This source file is subject to version 2.00 of the Zend license, |
b5b1117 @zsuraski License update
zsuraski authored
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
9 | available through the world-wide-web at the following url: |
d863d52 Update headers.
Sebastian Bergmann authored
10 | http://www.zend.com/license/2_00.txt. |
b5b1117 @zsuraski License update
zsuraski authored
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. |
573b460 @andigutmans Zend Library
andigutmans authored
14 +----------------------------------------------------------------------+
15 | Authors: Andi Gutmans <andi@zend.com> |
16 | Zeev Suraski <zeev@zend.com> |
17 +----------------------------------------------------------------------+
18 */
19
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
20 /* $Id$ */
b5b1117 @zsuraski License update
zsuraski authored
21
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
22 #ifndef ZEND_ALLOC_H
23 #define ZEND_ALLOC_H
573b460 @andigutmans Zend Library
andigutmans authored
24
25 #include <stdio.h>
26
9a0b61a @zsuraski Add thread-safety debugging information (idea - Dmitri Dmitrienko)
zsuraski authored
27 #include "../TSRM/TSRM.h"
29ed52f New memory manager
Dmitry Stogov authored
28 #include "zend.h"
99947a2 @andigutmans - Shift around header files.
andigutmans authored
29
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored
30 #ifndef ZEND_MM_ALIGNMENT
31 # define ZEND_MM_ALIGNMENT 8
32 # define ZEND_MM_ALIGNMENT_LOG2 3
33 #elif ZEND_MM_ALIGNMENT < 4
34 # undef ZEND_MM_ALIGNMENT
35 # undef ZEND_MM_ALIGNMENT_LOG2
36 # define ZEND_MM_ALIGNMENT 4
37 # define ZEND_MM_ALIGNMENT_LOG2 2
38 #endif
39
40 #define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1)
41
42 #define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
43
29ed52f New memory manager
Dmitry Stogov authored
44 typedef struct _zend_leak_info {
45 void *addr;
46 size_t size;
e43ff13 Fixed ZE specific compile warnings (Bug #55629)
Dmitry Stogov authored
47 const char *filename;
573b460 @andigutmans Zend Library
andigutmans authored
48 uint lineno;
e43ff13 Fixed ZE specific compile warnings (Bug #55629)
Dmitry Stogov authored
49 const char *orig_filename;
cda27ae @zsuraski Beef up debug macros
zsuraski authored
50 uint orig_lineno;
29ed52f New memory manager
Dmitry Stogov authored
51 } zend_leak_info;
573b460 @andigutmans Zend Library
andigutmans authored
52
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
53 BEGIN_EXTERN_C()
54
cf1f6e3 provide attribute((malloc)) where appropiate
Sascha Schumann authored
55 ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
ab3beff @zsuraski The new INI parser is showing some signs of life
zsuraski authored
56
58d2203 add support for the alloc_size __attribute__ (through ZEND_ATTRIBUTE_…
Nuno Lopes authored
57 ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1);
cf1f6e3 provide attribute((malloc)) where appropiate
Sascha Schumann authored
58 ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
182e93a - Add safe_pemalloc()
Moriyoshi Koizumi authored
59 ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset) ZEND_ATTRIBUTE_MALLOC;
cda27ae @zsuraski Beef up debug macros
zsuraski authored
60 ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
58d2203 add support for the alloc_size __attribute__ (through ZEND_ATTRIBUTE_…
Nuno Lopes authored
61 ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE2(1,2);
62 ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2);
624dd13 @smalyshev fix typo
smalyshev authored
63 ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
4274449 @smalyshev add safe_realloc
smalyshev authored
64 ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
cf1f6e3 provide attribute((malloc)) where appropiate
Sascha Schumann authored
65 ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
66 ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
29ed52f New memory manager
Dmitry Stogov authored
67 ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
f3d6620 @andigutmans - Commit Derick's patch for allowing Zend to use regular libc memory
andigutmans authored
68
aa8b27b @zsuraski Better debug macros
zsuraski authored
69 /* Standard wrapper macros */
29ed52f New memory manager
Dmitry Stogov authored
70 #define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
71 #define safe_emalloc(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
72 #define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
73 #define ecalloc(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
74 #define erealloc(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
4274449 @smalyshev add safe_realloc
smalyshev authored
75 #define safe_erealloc(ptr, nmemb, size, offset) _safe_erealloc((ptr), (nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
29ed52f New memory manager
Dmitry Stogov authored
76 #define erealloc_recoverable(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
77 #define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
78 #define estrndup(s, length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
79 #define zend_mem_block_size(ptr) _zend_mem_block_size((ptr) TSRMLS_CC ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
aa8b27b @zsuraski Better debug macros
zsuraski authored
80
81 /* Relay wrapper macros */
29ed52f New memory manager
Dmitry Stogov authored
82 #define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
83 #define safe_emalloc_rel(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
84 #define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
85 #define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
86 #define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
87 #define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
4274449 @smalyshev add safe_realloc
smalyshev authored
88 #define safe_erealloc_rel(ptr, nmemb, size, offset) _safe_erealloc((ptr), (nmemb), (size), (offset) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
29ed52f New memory manager
Dmitry Stogov authored
89 #define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
90 #define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
91 #define zend_mem_block_size_rel(ptr) _zend_mem_block_size((ptr) TSRMLS_CC ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
aa8b27b @zsuraski Better debug macros
zsuraski authored
92
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
93 inline static void * __zend_malloc(size_t len)
94 {
8defc04 @dsp Fix WS
dsp authored
95 void *tmp = malloc(len);
96 if (tmp) {
97 return tmp;
98 }
99 fprintf(stderr, "Out of memory\n");
100 exit(1);
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
101 }
102
0638ac7 Fixed calloc wrapper
Ilia Alshanetsky authored
103 inline static void * __zend_calloc(size_t nmemb, size_t len)
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
104 {
8defc04 @dsp Fix WS
dsp authored
105 void *tmp = _safe_malloc(nmemb, len, 0);
25c47a2 @pierrejoye - MF52: calloc must actually clear the requested size (Andrei)
pierrejoye authored
106 memset(tmp, 0, nmemb * len);
8defc04 @dsp Fix WS
dsp authored
107 return tmp;
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
108 }
109
110 inline static void * __zend_realloc(void *p, size_t len)
111 {
8defc04 @dsp Fix WS
dsp authored
112 p = realloc(p, len);
113 if (p) {
114 return p;
115 }
116 fprintf(stderr, "Out of memory\n");
117 exit(1);
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
118 }
119
120
aa8b27b @zsuraski Better debug macros
zsuraski authored
121 /* Selective persistent/non persistent allocation macros */
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
122 #define pemalloc(size, persistent) ((persistent)?__zend_malloc(size):emalloc(size))
182e93a - Add safe_pemalloc()
Moriyoshi Koizumi authored
123 #define safe_pemalloc(nmemb, size, offset, persistent) ((persistent)?_safe_malloc(nmemb, size, offset):safe_emalloc(nmemb, size, offset))
4f6c95d @zsuraski Whitespace
zsuraski authored
124 #define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
125 #define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size)))
126 #define perealloc(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc((ptr), (size)))
4274449 @smalyshev add safe_realloc
smalyshev authored
127 #define safe_perealloc(ptr, nmemb, size, offset, persistent) ((persistent)?_safe_realloc((ptr), (nmemb), (size), (offset)):safe_erealloc((ptr), (nmemb), (size), (offset)))
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
128 #define perealloc_recoverable(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable((ptr), (size)))
4f6c95d @zsuraski Whitespace
zsuraski authored
129 #define pestrdup(s, persistent) ((persistent)?strdup(s):estrdup(s))
0ff96cc MFH: Add pestrndup()
Matt Wilmas authored
130 #define pestrndup(s, length, persistent) ((persistent)?zend_strndup((s),(length)):estrndup((s),(length)))
573b460 @andigutmans Zend Library
andigutmans authored
131
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
132 #define pemalloc_rel(size, persistent) ((persistent)?__zend_malloc(size):emalloc_rel(size))
0dba58c @zsuraski Improve tracking
zsuraski authored
133 #define pefree_rel(ptr, persistent) ((persistent)?free(ptr):efree_rel(ptr))
f6343f4 Add checks around raw allocation code
Ilia Alshanetsky authored
134 #define pecalloc_rel(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc_rel((nmemb), (size)))
135 #define perealloc_rel(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_rel((ptr), (size)))
136 #define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size)))
0dba58c @zsuraski Improve tracking
zsuraski authored
137 #define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
138
355eefe - Nuke the code duplication
foobar authored
139 #define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
140 #define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
f3d6620 @andigutmans - Commit Derick's patch for allowing Zend to use regular libc memory
andigutmans authored
141
e5b5f00 @tony2001 MFH: fix #40800 (cannot disable memory_limit with -1)
tony2001 authored
142 ZEND_API int zend_set_memory_limit(size_t memory_limit);
2e9886d @zsuraski Get rid of php3_ini in Zend
zsuraski authored
143
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored
144 ZEND_API void start_memory_manager(TSRMLS_D);
db90fc4 @andigutmans - Fix memory leak in mem cache in conjunction with Zend MM. How come …
andigutmans authored
145 ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);
27c327b Added is_zend_mm() to allow runtime check for zend memory manager
Dmitry Stogov authored
146 ZEND_API int is_zend_mm(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
147
148 #if ZEND_DEBUG
cda27ae @zsuraski Beef up debug macros
zsuraski authored
149 ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
150 ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
9353650 Fix warnings surfacing in maintainer-mode.
Stig S. Bakken authored
151 void zend_debug_alloc_output(char *format, ...);
cda27ae @zsuraski Beef up debug macros
zsuraski authored
152 #define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
153 #define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
573b460 @andigutmans Zend Library
andigutmans authored
154 #else
155 #define mem_block_check(type, ptr, silent)
156 #define full_mem_check(silent)
157 #endif
158
356facf Changed memory_get_usage() and memory_get_peak_usage(). Optional bool…
Dmitry Stogov authored
159 ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC);
160 ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC);
29ed52f New memory manager
Dmitry Stogov authored
161
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
162 END_EXTERN_C()
163
29ed52f New memory manager
Dmitry Stogov authored
164 /* fast cache for zval's */
165 #define ALLOC_ZVAL(z) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
166 (z) = (zval *) emalloc(sizeof(zval))
29ed52f New memory manager
Dmitry Stogov authored
167
168 #define FREE_ZVAL(z) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
169 efree_rel(z)
29ed52f New memory manager
Dmitry Stogov authored
170
171 #define ALLOC_ZVAL_REL(z) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
172 (z) = (zval *) emalloc_rel(sizeof(zval))
29ed52f New memory manager
Dmitry Stogov authored
173
174 #define FREE_ZVAL_REL(z) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
175 efree_rel(z)
29ed52f New memory manager
Dmitry Stogov authored
176
177 /* fast cache for HashTables */
178 #define ALLOC_HASHTABLE(ht) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
179 (ht) = (HashTable *) emalloc(sizeof(HashTable))
29ed52f New memory manager
Dmitry Stogov authored
180
181 #define FREE_HASHTABLE(ht) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
182 efree(ht)
29ed52f New memory manager
Dmitry Stogov authored
183
184 #define ALLOC_HASHTABLE_REL(ht) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
185 (ht) = (HashTable *) emalloc_rel(sizeof(HashTable))
29ed52f New memory manager
Dmitry Stogov authored
186
187 #define FREE_HASHTABLE_REL(ht) \
4420a91 @pierrejoye - macros--; ZEND_FAST_* are now gone
pierrejoye authored
188 efree_rel(ht)
29ed52f New memory manager
Dmitry Stogov authored
189
190 /* Heap functions */
191 typedef struct _zend_mm_heap zend_mm_heap;
192
193 ZEND_API zend_mm_heap *zend_mm_startup(void);
85ab423 @felipensp - MFH: Removed some TSRMLS_FETCH()s
felipensp authored
194 ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent TSRMLS_DC);
29ed52f New memory manager
Dmitry Stogov authored
195 ZEND_API void *_zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
196 ZEND_API void _zend_mm_free(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
197 ZEND_API void *_zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
198 ZEND_API size_t _zend_mm_block_size(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
199
200 #define zend_mm_alloc(heap, size) _zend_mm_alloc((heap), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
201 #define zend_mm_free(heap, p) _zend_mm_free((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
202 #define zend_mm_realloc(heap, p, size) _zend_mm_realloc((heap), (p), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
877d5f8 @arnaud-lb MFH: Fix compile error
arnaud-lb authored
203 #define zend_mm_block_size(heap, p) _zend_mm_block_size((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
29ed52f New memory manager
Dmitry Stogov authored
204
205 #define zend_mm_alloc_rel(heap, size) _zend_mm_alloc((heap), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
206 #define zend_mm_free_rel(heap, p) _zend_mm_free((heap), (p) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
207 #define zend_mm_realloc_rel(heap, p, size) _zend_mm_realloc((heap), (p), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC)
877d5f8 @arnaud-lb MFH: Fix compile error
arnaud-lb authored
208 #define zend_mm_block_size_rel(heap, p) _zend_mm_block_size((heap), (p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
29ed52f New memory manager
Dmitry Stogov authored
209
210 /* Heaps with user defined storage */
211 typedef struct _zend_mm_storage zend_mm_storage;
212
213 typedef struct _zend_mm_segment {
214 size_t size;
215 struct _zend_mm_segment *next_segment;
216 } zend_mm_segment;
217
218 typedef struct _zend_mm_mem_handlers {
219 const char *name;
220 zend_mm_storage* (*init)(void *params);
221 void (*dtor)(zend_mm_storage *storage);
ae14f6b Added "compact" handler for Zend MM storage.
Dmitry Stogov authored
222 void (*compact)(zend_mm_storage *storage);
29ed52f New memory manager
Dmitry Stogov authored
223 zend_mm_segment* (*_alloc)(zend_mm_storage *storage, size_t size);
224 zend_mm_segment* (*_realloc)(zend_mm_storage *storage, zend_mm_segment *ptr, size_t size);
225 void (*_free)(zend_mm_storage *storage, zend_mm_segment *ptr);
226 } zend_mm_mem_handlers;
227
228 struct _zend_mm_storage {
229 const zend_mm_mem_handlers *handlers;
ff3dfa9 Allow future extensibility without binary compatibility break
Dmitry Stogov authored
230 void *data;
29ed52f New memory manager
Dmitry Stogov authored
231 };
232
d514bf2 Improved Zend Memory Manager to guarantee reasonable time for worst c…
Dmitry Stogov authored
233 ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, size_t block_size, size_t reserve_size, int internal, void *params);
29ed52f New memory manager
Dmitry Stogov authored
234 ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap TSRMLS_DC);
d514bf2 Improved Zend Memory Manager to guarantee reasonable time for worst c…
Dmitry Stogov authored
235 ZEND_API zend_mm_storage *zend_mm_get_storage(zend_mm_heap *heap);
29ed52f New memory manager
Dmitry Stogov authored
236
609aa05 Allow user defined malloc/realloc/free
Dmitry Stogov authored
237 ZEND_API void zend_mm_set_custom_handlers(zend_mm_heap *heap,
c3c5d27 Fixed windows build (Rob)
Dmitry Stogov authored
238 void* (*_malloc)(size_t),
239 void (*_free)(void*),
240 void* (*_realloc)(void*, size_t));
609aa05 Allow user defined malloc/realloc/free
Dmitry Stogov authored
241
573b460 @andigutmans Zend Library
andigutmans authored
242 #endif
243
244 /*
245 * Local variables:
246 * tab-width: 4
247 * c-basic-offset: 4
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
248 * indent-tabs-mode: t
573b460 @andigutmans Zend Library
andigutmans authored
249 * End:
250 */
Something went wrong with that request. Please try again.