]> granicus.if.org Git - php/commitdiff
Don't include non-refcounted structures in GC count
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 13 Aug 2019 10:08:59 +0000 (12:08 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 13 Aug 2019 10:08:59 +0000 (12:08 +0200)
Zend/tests/gc_017.phpt
Zend/tests/gc_033.phpt
Zend/zend_gc.c

index a1a8c3eaf6246a6f6dbc41cb157a50d281a1cb00..102c2b6bcbe0f1548baf9ad957f82b83b2bd312d 100644 (file)
@@ -31,12 +31,12 @@ $a->insert($c);
 unset($a);
 unset($b);
 unset($c);
-var_dump(gc_collect_cycles() >= 7);
+var_dump(gc_collect_cycles());
 echo "ok\n"
 ?>
 --EXPECTF--
 string(1) "%s"
 string(1) "%s"
 string(1) "%s"
-bool(true)
+int(4)
 ok
index 2db10196add13daabcfda63940ac946c0a52d8ee..1fd36976add0832ef3d8a48d05a00f77dbda8ac3 100644 (file)
@@ -27,4 +27,4 @@ for ($i=0; $i<9999; $i++) {
 var_dump(gc_collect_cycles());
 ?>
 --EXPECT--
-int(20001)
+int(10002)
index 7ff1412ad698d29cd16370c265e0fb6a6a4ec23b..199387643da34a09270177e44c581d6189405ee7 100644 (file)
@@ -1183,10 +1183,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
                                        ht = NULL;
                                        if (!n) goto next;
                                        while (!Z_REFCOUNTED_P(--end)) {
-                                               /* count non-refcounted for compatibility ??? */
-                                               if (Z_TYPE_P(zv) != IS_UNDEF) {
-                                                       count++;
-                                               }
                                                if (zv == end) goto next;
                                        }
                                } else {
@@ -1200,9 +1196,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
                                                        GC_REF_SET_BLACK(ref);
                                                        GC_STACK_PUSH(ref);
                                                }
-                                       /* count non-refcounted for compatibility ??? */
-                                       } else if (Z_TYPE_P(zv) != IS_UNDEF) {
-                                               count++;
                                        }
                                        zv++;
                                }
@@ -1250,10 +1243,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
                        if (Z_REFCOUNTED_P(zv)) {
                                break;
                        }
-                       /* count non-refcounted for compatibility ??? */
-                       if (Z_TYPE_P(zv) != IS_UNDEF) {
-                               count++;
-                       }
                        if (p == end) goto next;
                }
                while (p != end) {
@@ -1268,9 +1257,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
                                        GC_REF_SET_BLACK(ref);
                                        GC_STACK_PUSH(ref);
                                }
-                               /* count non-refcounted for compatibility ??? */
-                       } else if (Z_TYPE_P(zv) != IS_UNDEF) {
-                               count++;
                        }
                        p++;
                }