diff options
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r-- | Zend/zend_alloc.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index cd8cc50000..1e031f48f5 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -30,7 +30,7 @@ * performed using mmap(). The result is aligned on 2M boundary. * * Large - a number of 4096K pages inside a CHUNK. Large blocks - * are always alligned on page boundary. + * are always aligned on page boundary. * * Small - less than 3/4 of page size. Small sizes are rounded up to nearest * greater predefined small size (there are 30 predefined sizes: @@ -272,7 +272,7 @@ struct _zend_mm_page { }; /* - * bin - is one or few continuous pages (up to 8) used for alocation of + * bin - is one or few continuous pages (up to 8) used for allocation of * a particular "small size". */ struct _zend_mm_bin { @@ -395,10 +395,10 @@ stderr_last_error(char *msg) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buf, 0, NULL)) { - fprintf(stderr, "\n%s: [0x%08x]\n", msg, err); + fprintf(stderr, "\n%s: [0x%08lx]\n", msg, err); } else { - fprintf(stderr, "\n%s: [0x%08x] %s\n", msg, err, buf); + fprintf(stderr, "\n%s: [0x%08lx] %s\n", msg, err, buf); } } #endif @@ -2130,6 +2130,7 @@ ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size) return zend_mm_alloc_huge(AG(mm_heap), size); } +#if ZEND_DEBUG # define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \ ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \ TSRMLS_FETCH(); \ @@ -2144,6 +2145,18 @@ ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size) zend_mm_free_small(AG(mm_heap), ptr, _num); \ } \ } +#else +# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \ + ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \ + TSRMLS_FETCH(); \ + ZEND_MM_CUSTOM_DEALLOCATOR(ptr); \ + { \ + zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \ + ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \ + zend_mm_free_small(AG(mm_heap), ptr, _num); \ + } \ + } +#endif ZEND_MM_BINS_INFO(_ZEND_BIN_FREE, x, y) |