|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-04-30 02:05 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 04:00:02 2025 UTC |
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