Bug #69549 [Ana]: Memory leak with opcache.optimization_level=0xFFFFFFFF
| From: | laruence@php.net | Date: | Thu, 30 Apr 2015 17:06:19 +0000 |
| Subject: | Bug #69549 [Ana]: Memory leak with opcache.optimization_level=0xFFFFFFFF | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192433@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69549&edit=1
ID: 69549
Updated by: laruence@php.net
Reported by: naoki-kawamukai at cybozu dot co dot jp
Summary: Memory leak with
opcache.optimization_level=0xFFFFFFFF
Status: Analyzed
Type: Bug
Package: opcache
Operating System: Debian 7.8
PHP Version: 5.5Git-2015-04-30 (Git)
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
A quick fix is attached(which could show where the problem is): https://gist.github.com/laruence/153a3ad7ea739507c025
Previous Comments:
------------------------------------------------------------------------
[2015-04-30 12:08:49] laruence@php.net
instead of fix optimization in cfg ..
maybe we should insert some ZEND_FREE, considering following test script, the FETCH_OBJ_R should not
be optimized away:
<?php
class A {
public function __get($name) {
echo "__get: $name";
return "$name";
}
}
$a = new A;
if ($a->true && false) {
echo "bad";
}
thanks
------------------------------------------------------------------------
[2015-04-30 03:01:59] laruence@php.net
side affects by block pass optimization..
------------------------------------------------------------------------
[2015-04-30 02:05:26] naoki-kawamukai at cybozu dot co dot jp
Description:
------------
This leaks occurs on PHP 5.5(Git-2015-04-30), PHP 5.6(Git-2015-04-30).
But it does not occur on PHP 7.0(Git-2015-04-30)
My opcache configuration:
vagrant@php7dev:~$ php -i | grep opcache
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.fast_shutdown => 1 => 1
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.load_comments => 1 => 1
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 10000 => 10000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 256 => 256
opcache.optimization_level => 0xFFFFFFFF => 0xFFFFFFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_timestamps => On => On
Test script:
---------------
<?php
$a = array(true);
if($a[0] && false) {
echo 'test';
}
?>
Expected result:
----------------
Nothing happen.
Actual result:
--------------
Memory leaks.
vagrant@php7dev:~$ php -d opcache.enable_cli=1 -d opcache.optimization_level=0xFFFFFFFF leak.php
[Thu Apr 30 01:42:30 2015] Script: '/home/vagrant/leak.php'
/home/vagrant/php-src/Zend/zend_vm_execute.h(6257) : Freeing 0x7F6A57B167E0 (32 bytes),
script=/home/vagrant/leak.php
=== Total 1 memory leaks detected ===
When disabling opcache optimization, memory does not leak.
vagrant@php7dev:~$ php -d opcache.enable_cli=1 -d opcache.optimization_level=0 leak.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69549&edit=1