From: Dmitry Stogov Date: Mon, 8 Sep 2014 20:12:36 +0000 (+0400) Subject: Fixed GC problem (arrays may be recorded as possible root of garbage cycle. we have... X-Git-Tag: PRE_PHP7_REMOVALS~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c59300ac86dd02bcdacd6c1460a5b43e91a5bf49;p=php Fixed GC problem (arrays may be recorded as possible root of garbage cycle. we have to clear this info before deleting array) --- diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index b49f28f4e3..b34e90578d 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -198,6 +198,9 @@ static void zend_persist_zval(zval *z TSRMLS_DC) Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array)); zend_hash_persist_immutable(Z_ARRVAL_P(z) TSRMLS_CC); } else { + if (!zend_shared_alloc_get_xlat_entry(Z_ARR_P(z))) { + GC_REMOVE_FROM_BUFFER(Z_ARR_P(z)); + } zend_accel_store(Z_ARR_P(z), sizeof(zend_array)); zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval TSRMLS_CC); /* make immutable array */ @@ -251,6 +254,9 @@ static void zend_persist_zval_const(zval *z TSRMLS_DC) Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array)); zend_hash_persist_immutable(Z_ARRVAL_P(z) TSRMLS_CC); } else { + if (!zend_shared_alloc_get_xlat_entry(Z_ARR_P(z))) { + GC_REMOVE_FROM_BUFFER(Z_ARR_P(z)); + } zend_accel_store(Z_ARR_P(z), sizeof(zend_array)); zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval TSRMLS_CC); /* make immutable array */