Bug #68974 [NEW]: Memory leaks

From: Date: Mon, 02 Feb 2015 16:46:39 +0000
Subject: Bug #68974 [NEW]: Memory leaks
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190414@lists.php.net to get a copy of this message
From:             yunosh
Operating system: Linux
PHP version:      master-Git-2015-02-02 (Git)
Package:          PCRE related
Bug Type:         Bug
Bug description:Memory leaks

Description:
------------
Running our Routes testing suite
(https://github.com/horde/horde/tree/master/framework/Routes) I get a
bunch of memory leaks.

$ php framework/Routes/test/Horde/Routes/AllTests.php 
PHPUnit 4.4.0 by Sebastian Bergmann.

...............................................................  63 /
127 ( 49%)
.........................................S..................... 126 /
127 ( 99%)
.

Time: 679 ms, Memory: 10.00Mb

OK, but incomplete, skipped, or risky tests!
Tests: 127, Assertions: 868, Skipped: 1.
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_variables.c(247) :  Freeing
0x7FE0B8E56000 (64 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 9 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_API.c(896) :  Freeing 0x7FE0B8E56360 (64
bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 1 time
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(97) :  Freeing 0x7FE0B8E58A00
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 205 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(165) :  Freeing 0x7FE0B8EBEA00
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 3 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(97) :  Freeing 0x7FE0B8F12880
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 1 time
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(97) :  Freeing 0x7FE0B8F3B600
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 1 time
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(97) :  Freeing 0x7FE0B7A6B8C0
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 6 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(165) :  Freeing 0x7FE0B7A6D180
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 10 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(97) :  Freeing 0x7FE0B7A7C370
(48 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 4 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_execute.c(501) :  Freeing 0x7FE0B7B44818
(24 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 20 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(154) :  Freeing 0x7FE0B7B4A9C0
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(271) :  Freeing 0x7FE0B7B4AD80
(288 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 1 time
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(1249) :  Freeing 0x7FE0B7B4AEC0
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_variables.c(247) :  Freeing
0x7FE0B7B9C360 (64 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 19 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_API.c(896) :  Freeing 0x7FE0B7B9D480 (64
bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 3 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(422) :  Freeing 0x7FE0B7B9E000
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(97) :  Freeing 0x7FE0B7BBDE80
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 1 time
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(1249) :  Freeing 0x7FE0B780A280
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 370 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(271) :  Freeing 0x7FE0B780B7C0
(288 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 139 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(422) :  Freeing 0x7FE0B780BA40
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 215 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(154) :  Freeing 0x7FE0B780C1C0
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 109 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_variables.c(247) :  Freeing
0x7FE0B7815000 (64 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 670 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_API.c(896) :  Freeing 0x7FE0B78154E0 (64
bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 102 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(165) :  Freeing 0x7FE0B782F780
(40 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 21 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_vm_execute.h(28517) :  Freeing
0x7FE0B7830300 (64 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 36 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_execute.c(501) :  Freeing 0x7FE0B786E070
(24 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 64 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_vm_execute.h(26241) :  Freeing
0x7FE0B787C6C0 (64 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 4 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(1292) :  Freeing 0x7FE0B796B180
(288 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 2 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(97) :  Freeing 0x7FE0B79B1730
(40 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_variables.c(247) :  Freeing
0x7FE0B7606480 (64 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 90 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(154) :  Freeing 0x7FE0B7607780
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 20 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(1249) :  Freeing 0x7FE0B76078C0
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 60 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(271) :  Freeing 0x7FE0B7608F40
(288 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 5 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_hash.c(422) :  Freeing 0x7FE0B760B9C0
(256 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
/home/vagrant/php-src/Zend/zend_alloc.c(2247) : Actual location
(location was relayed)
Last leak repeated 5 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_API.c(896) :  Freeing 0x7FE0B760C0C0 (64
bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 21 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_vm_execute.h(28517) :  Freeing
0x7FE0B7615420 (64 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 5 times
[Mon Feb  2 16:40:55 2015]  Script: 
'/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php'
/home/vagrant/php-src/Zend/zend_string.h(165) :  Freeing 0x7FE0B7623580
(32 bytes),
script=/home/vagrant/horde/framework/Routes/test/Horde/Routes/AllTests.php
Last leak repeated 4 times
=== Total 2263 memory leaks detected ===

$ valgrind --leak-check=full php
framework/Routes/test/Horde/Routes/AllTests.php 
==23171== Memcheck, a memory error detector
==23171== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et
al.
==23171== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
info
==23171== Command: php framework/Routes/test/Horde/Routes/AllTests.php
==23171== 
PHPUnit 4.4.0 by Sebastian Bergmann.

...............................................................  63 /
127 ( 49%)
.........................................S.............==23171== Invalid
read of size 1
==23171==    at 0xF9A18F1: ???
==23171==    by 0x5162C0: _pcre_jit_exec (pcre_jit_compile.c:10433)
==23171==    by 0x4E293F: php_pcre_exec (pcre_exec.c:6487)
==23171==    by 0x51A74D: php_pcre_replace_impl (php_pcre.c:1093)
==23171==    by 0x51A43E: php_pcre_replace (php_pcre.c:1003)
==23171==    by 0x51B0FF: php_replace_in_subject (php_pcre.c:1313)
==23171==    by 0x51BD44: preg_replace_impl (php_pcre.c:1410)
==23171==    by 0x51BE5E: zif_preg_replace (php_pcre.c:1430)
==23171==    by 0xAC1F22: ZEND_DO_FCALL_SPEC_HANDLER
(zend_vm_execute.h:596)
==23171==    by 0xAC14C7: execute_ex (zend_vm_execute.h:352)
==23171==    by 0xA5BC23: zend_call_function (zend_execute_API.c:835)
==23171==    by 0x7F1C61: zim_reflection_method_invokeArgs
(php_reflection.c:3079)
==23171==  Address 0xf4241 is not stack'd, malloc'd or (recently)
free'd
==23171== 
==23171== 
==23171== Process terminating with default action of signal 11
(SIGSEGV)
==23171==  Access not within mapped region at address 0xF4241
==23171==    at 0xF9A18F1: ???
==23171==    by 0x5162C0: _pcre_jit_exec (pcre_jit_compile.c:10433)
==23171==    by 0x4E293F: php_pcre_exec (pcre_exec.c:6487)
==23171==    by 0x51A74D: php_pcre_replace_impl (php_pcre.c:1093)
==23171==    by 0x51A43E: php_pcre_replace (php_pcre.c:1003)
==23171==    by 0x51B0FF: php_replace_in_subject (php_pcre.c:1313)
==23171==    by 0x51BD44: preg_replace_impl (php_pcre.c:1410)
==23171==    by 0x51BE5E: zif_preg_replace (php_pcre.c:1430)
==23171==    by 0xAC1F22: ZEND_DO_FCALL_SPEC_HANDLER
(zend_vm_execute.h:596)
==23171==    by 0xAC14C7: execute_ex (zend_vm_execute.h:352)
==23171==    by 0xA5BC23: zend_call_function (zend_execute_API.c:835)
==23171==    by 0x7F1C61: zim_reflection_method_invokeArgs
(php_reflection.c:3079)
==23171==  If you believe this happened as a result of a stack
==23171==  overflow in your program's main thread (unlikely but
==23171==  possible), you can try to increase the size of the
==23171==  main thread stack using the --main-stacksize= flag.
==23171==  The main thread stack size used in this run was 8388608.
==23171== 
==23171== HEAP SUMMARY:
==23171==     in use at exit: 2,296,754 bytes in 21,620 blocks
==23171==   total heap usage: 27,734 allocs, 6,114 frees, 4,307,427
bytes allocated
==23171== 
==23171== LEAK SUMMARY:
==23171==    definitely lost: 0 bytes in 0 blocks
==23171==    indirectly lost: 0 bytes in 0 blocks
==23171==      possibly lost: 0 bytes in 0 blocks
==23171==    still reachable: 2,296,754 bytes in 21,620 blocks
==23171==         suppressed: 0 bytes in 0 blocks
==23171== Reachable blocks (those to which a pointer was found) are not
shown.
==23171== To see them, rerun with: --leak-check=full
--show-reachable=yes
==23171== 
==23171== For counts of detected and suppressed errors, rerun with: -v
==23171== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 30 from
6)
Segmentation fault



-- 
Edit bug report at https://bugs.php.net/bug.php?id=68974&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=68974&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=68974&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=68974&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=68974&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=68974&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=68974&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=68974&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=68974&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=68974&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=68974&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=68974&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=68974&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=68974&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68974&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=68974&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=68974&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=68974&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68974&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=68974&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=68974&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#190414) next »