Skip to content

Commit 4a075f8

Browse files
committed
Fix
1 parent 8342ecb commit 4a075f8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Zend/zend_gc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,12 +1469,13 @@ static void zend_gc_root_tmpvars(void);
14691469

14701470
ZEND_API int zend_gc_collect_cycles(void)
14711471
{
1472-
int count = 0;
1472+
int total_count = 0;
14731473
bool should_rerun_gc = 0;
14741474
bool did_rerun_gc = 0;
14751475

14761476
rerun_gc:
14771477
if (GC_G(num_roots)) {
1478+
int count;
14781479
gc_root_buffer *current, *last;
14791480
zend_refcounted *p;
14801481
uint32_t gc_flags = 0;
@@ -1498,7 +1499,7 @@ ZEND_API int zend_gc_collect_cycles(void)
14981499
gc_scan_roots(&stack);
14991500

15001501
GC_TRACE("Collecting roots");
1501-
count += gc_collect_roots(&gc_flags, &stack);
1502+
count = gc_collect_roots(&gc_flags, &stack);
15021503

15031504
if (!GC_G(num_roots)) {
15041505
/* nothing to free */
@@ -1652,6 +1653,7 @@ ZEND_API int zend_gc_collect_cycles(void)
16521653

16531654
GC_TRACE("Collection finished");
16541655
GC_G(collected) += count;
1656+
total_count += count;
16551657
GC_G(gc_active) = 0;
16561658
}
16571659

@@ -1668,7 +1670,7 @@ ZEND_API int zend_gc_collect_cycles(void)
16681670
finish:
16691671
zend_get_gc_buffer_release();
16701672
zend_gc_root_tmpvars();
1671-
return count;
1673+
return total_count;
16721674
}
16731675

16741676
ZEND_API void zend_gc_get_status(zend_gc_status *status)

0 commit comments

Comments
 (0)