if (CACHE_INDEX<MAX_CACHED_MEMORY) {
AG(cache_stats)[CACHE_INDEX][0]++;
}
+#endif
+#if MEMORY_LIMIT
+ CHECK_MEMORY_LIMIT(size, SIZE);
+ if (AG(allocated_memory) > AG(allocated_memory_peak)) {
+ AG(allocated_memory_peak) = AG(allocated_memory);
+ }
#endif
p = (zend_mem_header *) ZEND_DO_MALLOC(sizeof(zend_mem_header) + MEM_HEADER_PADDING + SIZE + END_MAGIC_SIZE);
#if !ZEND_DISABLE_MEMORY_CACHE
# endif
memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
#endif
-#if MEMORY_LIMIT
- CHECK_MEMORY_LIMIT(size, SIZE);
- if (AG(allocated_memory) > AG(allocated_memory_peak)) {
- AG(allocated_memory_peak) = AG(allocated_memory);
- }
-#endif
HANDLE_UNBLOCK_INTERRUPTIONS();
return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING);
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
HANDLE_BLOCK_INTERRUPTIONS();
+#if MEMORY_LIMIT
+ CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
+ if (AG(allocated_memory) > AG(allocated_memory_peak)) {
+ AG(allocated_memory_peak) = AG(allocated_memory);
+ }
+#endif
#if ZEND_DEBUG || !defined(ZEND_MM)
REMOVE_POINTER_FROM_LIST(p);
#endif
p->magic = MEM_BLOCK_START_MAGIC;
memcpy((((char *) p) + sizeof(zend_mem_header) + MEM_HEADER_PADDING + size), &mem_block_end_magic, sizeof(long));
#endif
-#if MEMORY_LIMIT
- CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
- if (AG(allocated_memory) > AG(allocated_memory_peak)) {
- AG(allocated_memory_peak) = AG(allocated_memory);
- }
-#endif
p->size = size;