@@ -2274,8 +2274,6 @@ void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent)
2274
2274
/* free the first chunk */
2275
2275
zend_mm_chunk_free (heap , heap -> main_chunk , ZEND_MM_CHUNK_SIZE );
2276
2276
} else {
2277
- zend_mm_heap old_heap ;
2278
-
2279
2277
/* free some cached chunks to keep average count */
2280
2278
heap -> avg_chunks_count = (heap -> avg_chunks_count + (double )heap -> peak_chunks_count ) / 2.0 ;
2281
2279
while ((double )heap -> cached_chunks_count + 0.9 > heap -> avg_chunks_count &&
@@ -2295,30 +2293,32 @@ void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent)
2295
2293
}
2296
2294
2297
2295
/* reinitialize the first chunk and heap */
2298
- old_heap = * heap ;
2299
2296
p = heap -> main_chunk ;
2300
- memset (p , 0 , ZEND_MM_FIRST_PAGE * ZEND_MM_PAGE_SIZE );
2301
- * heap = old_heap ;
2302
- memset (heap -> free_slot , 0 , sizeof (heap -> free_slot ));
2303
- heap -> main_chunk = p ;
2304
2297
p -> heap = & p -> heap_slot ;
2305
2298
p -> next = p ;
2306
2299
p -> prev = p ;
2307
2300
p -> free_pages = ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE ;
2308
2301
p -> free_tail = ZEND_MM_FIRST_PAGE ;
2309
- p -> free_map [ 0 ] = ( 1L << ZEND_MM_FIRST_PAGE ) - 1 ;
2310
- p -> map [ 0 ] = ZEND_MM_LRUN ( ZEND_MM_FIRST_PAGE );
2311
- heap -> chunks_count = 1 ;
2312
- heap -> peak_chunks_count = 1 ;
2313
- heap -> last_chunks_delete_boundary = 0 ;
2314
- heap -> last_chunks_delete_count = 0 ;
2302
+ p -> num = 0 ;
2303
+
2304
+ #if ZEND_MM_STAT
2305
+ heap -> size = heap -> peak = 0 ;
2306
+ #endif
2307
+ memset ( heap -> free_slot , 0 , sizeof ( heap -> free_slot )) ;
2315
2308
#if ZEND_MM_STAT || ZEND_MM_LIMIT
2316
2309
heap -> real_size = ZEND_MM_CHUNK_SIZE ;
2317
2310
#endif
2318
2311
#if ZEND_MM_STAT
2319
2312
heap -> real_peak = ZEND_MM_CHUNK_SIZE ;
2320
- heap -> size = heap -> peak = 0 ;
2321
2313
#endif
2314
+ heap -> chunks_count = 1 ;
2315
+ heap -> peak_chunks_count = 1 ;
2316
+ heap -> last_chunks_delete_boundary = 0 ;
2317
+ heap -> last_chunks_delete_count = 0 ;
2318
+
2319
+ memset (p -> free_map , 0 , sizeof (p -> free_map ) + sizeof (p -> map ));
2320
+ p -> free_map [0 ] = (1L << ZEND_MM_FIRST_PAGE ) - 1 ;
2321
+ p -> map [0 ] = ZEND_MM_LRUN (ZEND_MM_FIRST_PAGE );
2322
2322
}
2323
2323
}
2324
2324
0 commit comments