@@ -179,14 +179,14 @@ static size_t _real_page_size = ZEND_MM_PAGE_SIZE;
179179# include <sanitizer/asan_interface.h>
180180
181181#define ZEND_ASAN_POISON_MEMORY_REGION (_ptr , _size ) do { \
182- // printf("Poisoning memory %p, size %zu %d\n", (_ptr), (_size), __LINE__); \
182+ printf("Poisoning memory %p, size %zu %d\n", (_ptr), (_size), __LINE__); \
183183 if (UNEXPECTED(((size_t) (_ptr)) & ((size_t)7))) { \
184184 zend_mm_panic("Wrong alignment"); \
185185 } \
186186 ASAN_POISON_MEMORY_REGION((_ptr), (_size));\
187187} while (0);
188188#define ZEND_ASAN_UNPOISON_MEMORY_REGION (_ptr , _size ) do { \
189- // printf("Unpoisoning memory %p, size %zu line %d\n", (_ptr), (_size), __LINE__); \
189+ printf("Unpoisoning memory %p, size %zu line %d\n", (_ptr), (_size), __LINE__); \
190190 if (UNEXPECTED(((size_t) (_ptr)) & ((size_t)7))) { \
191191 zend_mm_panic("Wrong alignment"); \
192192 } \
@@ -404,20 +404,20 @@ ZEND_COLD void zend_debug_alloc_output(char *format, ...)
404404 va_list args ;
405405
406406 va_start (args , format );
407- vs //printf (output_buf, format, args);
407+ vsprintf (output_buf , format , args );
408408 va_end (args );
409409
410410#ifdef ZEND_WIN32
411411 OutputDebugString (output_buf );
412412#else
413- f //printf (stderr, "%s", output_buf);
413+ fprintf (stderr , "%s" , output_buf );
414414#endif
415415}
416416#endif
417417
418418static ZEND_COLD ZEND_NORETURN void zend_mm_panic (const char * message )
419419{
420- f //printf (stderr, "%s\n", message);
420+ fprintf (stderr , "%s\n" , message );
421421/* See http://support.microsoft.com/kb/190351 */
422422#ifdef ZEND_WIN32
423423 fflush (stderr );
@@ -461,10 +461,10 @@ static void stderr_last_error(char *msg)
461461 char * buf = php_win32_error_to_msg (err );
462462
463463 if (!buf [0 ]) {
464- f //printf (stderr, "\n%s: [0x%08lx]\n", msg, err);
464+ fprintf (stderr , "\n%s: [0x%08lx]\n" , msg , err );
465465 }
466466 else {
467- f //printf (stderr, "\n%s: [0x%08lx] %s\n", msg, err, buf);
467+ fprintf (stderr , "\n%s: [0x%08lx] %s\n" , msg , err , buf );
468468 }
469469
470470 php_win32_error_msg_free (buf );
@@ -506,7 +506,7 @@ static void zend_mm_munmap(void *addr, size_t size)
506506#else
507507 if (munmap (addr , size ) != 0 ) {
508508#if ZEND_MM_ERROR
509- f //printf (stderr, "\nmunmap() failed: [%d] %s\n", errno, strerror(errno));
509+ fprintf (stderr , "\nmunmap() failed: [%d] %s\n" , errno , strerror (errno ));
510510#endif
511511 }
512512#endif
@@ -542,7 +542,7 @@ static void *zend_mm_mmap_fixed(void *addr, size_t size)
542542
543543 if (ptr == MAP_FAILED ) {
544544#if ZEND_MM_ERROR && !defined(MAP_EXCL ) && !defined(MAP_TRYFIXED )
545- f //printf (stderr, "\nmmap() fixed failed: [%d] %s\n", errno, strerror(errno));
545+ fprintf (stderr , "\nmmap() fixed failed: [%d] %s\n" , errno , strerror (errno ));
546546#endif
547547 return NULL ;
548548 } else if (ptr != addr ) {
@@ -590,7 +590,7 @@ static void *zend_mm_mmap(size_t size)
590590
591591 if (ptr == MAP_FAILED ) {
592592#if ZEND_MM_ERROR
593- f //printf (stderr, "\nmmap() failed: [%d] %s\n", errno, strerror(errno));
593+ fprintf (stderr , "\nmmap() failed: [%d] %s\n" , errno , strerror (errno ));
594594#endif
595595 return NULL ;
596596 }
@@ -1208,7 +1208,7 @@ static zend_never_inline void zend_mm_free_pages(zend_mm_heap *heap, zend_mm_chu
12081208
12091209static zend_always_inline void zend_mm_free_large (zend_mm_heap * heap , zend_mm_chunk * chunk , int page_num , int pages_count )
12101210{
1211- // printf("Freeing large %p\n", chunk);
1211+ printf ("Freeing large %p\n" , chunk );
12121212#if ZEND_MM_STAT
12131213 heap -> size -= pages_count * ZEND_MM_PAGE_SIZE ;
12141214#endif
@@ -1317,7 +1317,7 @@ static zend_always_inline zend_mm_free_slot* zend_mm_decode_free_slot(zend_mm_he
13171317
13181318static zend_always_inline void zend_mm_set_next_free_slot (const char * from , zend_mm_heap * heap , uint32_t bin_num , zend_mm_free_slot * slot , zend_mm_free_slot * next )
13191319{
1320- // printf("set_next_free_slot from %s: slot %p, next: %p, size: %d\n", from, slot, next, bin_data_size[bin_num]);
1320+ printf ("set_next_free_slot from %s: slot %p, next: %p, size: %d\n" , from , slot , next , bin_data_size [bin_num ]);
13211321
13221322 ZEND_MM_ASSERT (bin_data_size [bin_num ] >= ZEND_MM_MIN_USEABLE_BIN_SIZE );
13231323
@@ -1333,7 +1333,7 @@ static zend_always_inline void zend_mm_set_next_free_slot(const char *from, zend
13331333
13341334static zend_always_inline zend_mm_free_slot * zend_mm_get_next_free_slot (zend_mm_heap * heap , uint32_t bin_num , zend_mm_free_slot * slot )
13351335{
1336- // printf("get_next_free_slot: slot %p, size: %d\n", slot, bin_data_size[bin_num]);
1336+ printf ("get_next_free_slot: slot %p, size: %d\n" , slot , bin_data_size [bin_num ]);
13371337
13381338 ZEND_ASAN_UNPOISON_MEMORY_REGION (slot , 8 );
13391339 ZEND_ASAN_UNPOISON_MEMORY_REGION (& ZEND_MM_FREE_SLOT_PTR_SHADOW (slot , bin_num ), 8 );
@@ -1357,7 +1357,7 @@ static zend_always_inline zend_mm_free_slot *zend_mm_get_next_free_slot(zend_mm_
13571357
13581358static zend_never_inline void * zend_mm_alloc_small_slow (zend_mm_heap * heap , uint32_t bin_num ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )
13591359{
1360- // printf("Alocating small size %d\n", bin_data_size[bin_num]);
1360+ printf ("Alocating small size %d\n" , bin_data_size [bin_num ]);
13611361 zend_mm_chunk * chunk ;
13621362 int page_num ;
13631363 zend_mm_bin * bin ;
@@ -1405,7 +1405,7 @@ static zend_never_inline void *zend_mm_alloc_small_slow(zend_mm_heap *heap, uint
14051405 } while (p != end );
14061406
14071407 zend_mm_set_next_free_slot ("alloc_small" , heap , bin_num , p , NULL );
1408- // printf("poison final: slot %p, size: %d\n", p, bin_data_size[bin_num]);
1408+ printf ("poison final: slot %p, size: %d\n" , p , bin_data_size [bin_num ]);
14091409
14101410#if ZEND_DEBUG
14111411 do {
@@ -1435,7 +1435,7 @@ static zend_always_inline void *zend_mm_alloc_small(zend_mm_heap *heap, int bin_
14351435 zend_mm_free_slot * p = heap -> free_slot [bin_num ];
14361436 heap -> free_slot [bin_num ] = zend_mm_get_next_free_slot (heap , bin_num , p );
14371437
1438- // printf("Returning slot %p, size %d, value %ld\n", p, bin_data_size[bin_num], (uint64_t) p);
1438+ printf ("Returning slot %p, size %d, value %ld\n" , p , bin_data_size [bin_num ], (uint64_t ) p );
14391439 return p ;
14401440 } else {
14411441 return zend_mm_alloc_small_slow (heap , bin_num ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC );
@@ -1444,7 +1444,7 @@ static zend_always_inline void *zend_mm_alloc_small(zend_mm_heap *heap, int bin_
14441444
14451445static zend_always_inline void zend_mm_free_small (zend_mm_heap * heap , void * ptr , int bin_num )
14461446{
1447- // printf("Freeing small size %d, ptr %p\n", bin_data_size[bin_num], ptr);
1447+ printf ("Freeing small size %d, ptr %p\n" , bin_data_size [bin_num ], ptr );
14481448
14491449 ZEND_MM_ASSERT (bin_data_size [bin_num ] >= ZEND_MM_MIN_USEABLE_BIN_SIZE );
14501450
@@ -1545,13 +1545,13 @@ static zend_always_inline void *zend_mm_alloc_heap(zend_mm_heap *heap, size_t si
15451545 ptr = zend_mm_alloc_huge (heap , size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC );
15461546 }
15471547 ZEND_ASAN_UNPOISON_MEMORY_REGION (ptr , size );
1548- // printf("Allocated %zu bytes at %p\n", size, ptr);
1548+ printf ("Allocated %zu bytes at %p\n" , size , ptr );
15491549 return ptr ;
15501550}
15511551
15521552static zend_always_inline void zend_mm_free_heap (zend_mm_heap * heap , void * ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )
15531553{
1554- // printf("Freeing %p\n", ptr);
1554+ printf ("Freeing %p\n" , ptr );
15551555
15561556 size_t page_offset = ZEND_MM_ALIGNED_OFFSET (ptr , ZEND_MM_CHUNK_SIZE );
15571557
@@ -1730,7 +1730,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
17301730 } else {
17311731 ret = zend_mm_realloc_huge (heap , ptr , size , copy_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC );
17321732 }
1733- // printf("Reallocated (1) %zu bytes from %p to %p\n", size, ptr, ret);
1733+ printf ("Reallocated (1) %zu bytes from %p to %p\n" , size , ptr , ret );
17341734 return ret ;
17351735 } else {
17361736 zend_mm_chunk * chunk = (zend_mm_chunk * )ZEND_MM_ALIGNED_BASE (ptr , ZEND_MM_CHUNK_SIZE );
@@ -1767,12 +1767,12 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
17671767 ZEND_ASAN_UNPOISON_MEMORY_REGION (ptr , copy_size );
17681768 memcpy (ret , ptr , copy_size );
17691769 zend_mm_free_small (heap , ptr , old_bin_num );
1770- // printf("Reallocated (2, 1) %zu bytes from %p to %p\n", size, ptr, ret);
1770+ printf ("Reallocated (2, 1) %zu bytes from %p to %p\n" , size , ptr , ret );
17711771 } else {
17721772 /* reallocation in-place */
17731773 ret = ptr ;
17741774 ZEND_ASAN_UNPOISON_MEMORY_REGION (ret , size );
1775- // printf("Reallocated (2, 2) %zu bytes from %p to %p\n", size, ptr, ret);
1775+ printf ("Reallocated (2, 2) %zu bytes from %p to %p\n" , size , ptr , ret );
17761776 }
17771777 } else if (size <= ZEND_MM_MAX_SMALL_SIZE ) {
17781778 /* small extension */
@@ -1791,7 +1791,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
17911791 heap -> peak = MAX (orig_peak , heap -> size );
17921792 } while (0 );
17931793#endif
1794- // printf("Reallocated (2, 3) %zu bytes from %p to %p\n", size, ptr, ret);
1794+ printf ("Reallocated (2, 3) %zu bytes from %p to %p\n" , size , ptr , ret );
17951795 } else {
17961796 /* slow reallocation */
17971797 break ;
@@ -1824,7 +1824,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18241824 dbg -> orig_lineno = __zend_orig_lineno ;
18251825#endif
18261826 ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP (chunk , heap );
1827- // printf("Reallocated (3) %zu bytes from %p to %p\n", size, ptr, ptr);
1827+ printf ("Reallocated (3) %zu bytes from %p to %p\n" , size , ptr , ptr );
18281828 return ptr ;
18291829 } else if (new_size < old_size ) {
18301830 /* free tail pages */
@@ -1848,7 +1848,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18481848 dbg -> orig_lineno = __zend_orig_lineno ;
18491849#endif
18501850 ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP (chunk , heap );
1851- // printf("Reallocated (4) %zu bytes from %p to %p\n", size, ptr, ptr);
1851+ printf ("Reallocated (4) %zu bytes from %p to %p\n" , size , ptr , ptr );
18521852 return ptr ;
18531853 } else /* if (new_size > old_size) */ {
18541854 int new_pages_count = (int )(new_size / ZEND_MM_PAGE_SIZE );
@@ -1878,7 +1878,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18781878 dbg -> orig_lineno = __zend_orig_lineno ;
18791879#endif
18801880 ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP (chunk , heap );
1881- // printf("Reallocated (5) %zu bytes from %p to %p\n", size, ptr, ptr);
1881+ printf ("Reallocated (5) %zu bytes from %p to %p\n" , size , ptr , ptr );
18821882 return ptr ;
18831883 }
18841884 }
@@ -1892,7 +1892,7 @@ static zend_always_inline void *zend_mm_realloc_heap(zend_mm_heap *heap, void *p
18921892
18931893 copy_size = MIN (old_size , copy_size );
18941894 ret = zend_mm_realloc_slow (heap , ptr , size , copy_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC );
1895- // printf("Reallocated (6) %zu bytes from %p to %p\n", size, ptr, ret);
1895+ printf ("Reallocated (6) %zu bytes from %p to %p\n" , size , ptr , ret );
18961896 return ret ;
18971897}
18981898
@@ -2055,7 +2055,7 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
20552055
20562056static void zend_mm_free_huge (zend_mm_heap * heap , void * ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )
20572057{
2058- // printf("Freeing huge %p\n", ptr);
2058+ printf ("Freeing huge %p\n" , ptr );
20592059
20602060 size_t size ;
20612061
@@ -2093,7 +2093,7 @@ static zend_mm_heap *zend_mm_init(void)
20932093
20942094 if (UNEXPECTED (chunk == NULL )) {
20952095#if ZEND_MM_ERROR
2096- f //printf (stderr, "Can't initialize heap\n");
2096+ fprintf (stderr , "Can't initialize heap\n" );
20972097#endif
20982098 return NULL ;
20992099 }
@@ -2142,7 +2142,7 @@ static zend_mm_heap *zend_mm_init(void)
21422142
21432143ZEND_API size_t zend_mm_gc (zend_mm_heap * heap )
21442144{
2145- // printf("Running gc\n");
2145+ printf ("Running gc\n" );
21462146 zend_mm_free_slot * p , * q ;
21472147 zend_mm_chunk * chunk ;
21482148 size_t page_offset ;
@@ -2190,7 +2190,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
21902190 chunk -> map [page_num ] = ZEND_MM_SRUN_EX (i , free_counter );
21912191
21922192 ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP (chunk , heap );
2193- // printf("Getting next slot from %p during GC\n", p);
2193+ printf ("Getting next slot from %p during GC\n" , p );
21942194 p = zend_mm_get_next_free_slot (heap , i , p );
21952195 }
21962196
@@ -2221,7 +2221,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
22212221 ZEND_MM_ASSERT (ZEND_MM_SRUN_BIN_NUM (info ) == i );
22222222 if (ZEND_MM_SRUN_FREE_COUNTER (info ) == bin_elements [i ]) {
22232223 /* remove from cache */
2224- // printf("Getting next slot from %p during GC (2)\n", p);
2224+ printf ("Getting next slot from %p during GC (2)\n" , p );
22252225 p = zend_mm_get_next_free_slot (heap , i , p );
22262226 if (q == (zend_mm_free_slot * )& heap -> free_slot [i ]) {
22272227 q -> next_free_slot = p ;
@@ -2233,7 +2233,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
22332233 if (q == (zend_mm_free_slot * )& heap -> free_slot [i ]) {
22342234 p = q -> next_free_slot ;
22352235 } else {
2236- // printf("Getting next slot from %p during GC (3)\n", q);
2236+ printf ("Getting next slot from %p during GC (3)\n" , q );
22372237 p = zend_mm_get_next_free_slot (heap , i , q );
22382238 }
22392239 }
@@ -2282,7 +2282,7 @@ ZEND_API size_t zend_mm_gc(zend_mm_heap *heap)
22822282 ZEND_ASAN_POISON_CHUNK_HEADER_NOT_HEAP (chunk , heap );
22832283 ZEND_ASAN_POISON_MEMORY_REGION (heap , sizeof (zend_mm_heap ));
22842284
2285- // printf("Done running gc\n");
2285+ printf ("Done running gc\n" );
22862286 return collected * ZEND_MM_PAGE_SIZE ;
22872287}
22882288
@@ -2930,14 +2930,14 @@ ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
29302930 }
29312931#endif
29322932 void * ptr = zend_mm_alloc_heap (AG (mm_heap ), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC );
2933- // printf("Alloced %p of size %zu\n", ptr, size);
2933+ printf ("Alloced %p of size %zu\n" , ptr , size );
29342934 ZEND_ASAN_POISON_MEMORY_REGION (AG (mm_heap ), sizeof (zend_mm_heap ));
29352935 return ptr ;
29362936}
29372937
29382938ZEND_API void ZEND_FASTCALL _efree (void * ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )
29392939{
2940- // printf("Freed %p\n", ptr);
2940+ printf ("Freed %p\n" , ptr );
29412941 ZEND_ASAN_UNPOISON_MEMORY_REGION (AG (mm_heap ), sizeof (zend_mm_heap ));
29422942#if ZEND_MM_CUSTOM
29432943 if (UNEXPECTED (AG (mm_heap )-> use_custom_heap )) {
@@ -3157,7 +3157,7 @@ ZEND_API void shutdown_memory_manager(bool silent, bool full_shutdown)
31573157
31583158static ZEND_COLD ZEND_NORETURN void zend_out_of_memory (void )
31593159{
3160- f //printf (stderr, "Out of memory\n");
3160+ fprintf (stderr , "Out of memory\n" );
31613161 exit (1 );
31623162}
31633163
@@ -3466,7 +3466,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void
34663466 chunk = (zend_mm_chunk * )handlers -> chunk_alloc (& tmp_storage , ZEND_MM_CHUNK_SIZE , ZEND_MM_CHUNK_SIZE );
34673467 if (UNEXPECTED (chunk == NULL )) {
34683468#if ZEND_MM_ERROR
3469- f //printf (stderr, "Can't initialize heap\n");
3469+ fprintf (stderr , "Can't initialize heap\n" );
34703470#endif
34713471 return NULL ;
34723472 }
@@ -3511,7 +3511,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void
35113511 if (!storage ) {
35123512 handlers -> chunk_free (& tmp_storage , chunk , ZEND_MM_CHUNK_SIZE );
35133513#if ZEND_MM_ERROR
3514- f //printf (stderr, "Can't initialize heap\n");
3514+ fprintf (stderr , "Can't initialize heap\n" );
35153515#endif
35163516 return NULL ;
35173517 }
0 commit comments