Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51802 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3384 invoked from network); 3 Apr 2011 11:12:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2011 11:12:19 -0000 Authentication-Results: pb1.pair.com header.from=Pascal.Courtois@nouvo.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=Pascal.Courtois@nouvo.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain nouvo.com designates 91.121.162.155 as permitted sender) X-PHP-List-Original-Sender: Pascal.Courtois@nouvo.com X-Host-Fingerprint: 91.121.162.155 sociatom2.sociatom.com Received: from [91.121.162.155] ([91.121.162.155:51226] helo=ks360347.kimsufi.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/E3-52504-216589D4 for ; Sun, 03 Apr 2011 07:12:19 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ks360347.kimsufi.com (Postfix) with ESMTP id F2282500F5 for ; Sun, 3 Apr 2011 13:12:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at sociatom.com Received: from ks360347.kimsufi.com ([127.0.0.1]) by localhost (ks360347.kimsufi.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uZ1txfw1-EsC for ; Sun, 3 Apr 2011 13:11:57 +0200 (CEST) Received: from [192.168.0.205] (lns-bzn-47f-62-147-131-15.adsl.proxad.net [62.147.131.15]) by ks360347.kimsufi.com (Postfix) with ESMTPA for ; Sun, 3 Apr 2011 13:11:57 +0200 (CEST) Message-ID: <4D985602.2080703@nouvo.com> Date: Sun, 03 Apr 2011 13:12:02 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: internals@lists.php.net References: <4D95B6AB.30608@templeet.org> <4D960169.3000400@templeet.org> <4D9849EA.9010805@nouvo.com> In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] how to find a memory corruption in php ? From: Pascal.Courtois@nouvo.com (Pascal COURTOIS) Le 03/04/2011 12:46, Pierre Joye a écrit : > USE_ZEND_ALLOC=0 valgrind php --leak-check=full sapi/cli/php ... (or > httpd if you use apache or only reproducible there) > > That will tell you if there are actual leaks. it IS leaking: ==9772== Memcheck, a memory error detector ==9772== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==9772== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==9772== Command: /home/courtois/php-5.3.6/sapi/cgi/php-cgi ==9772== /var/www/dev4.sociatomdev.com/chroot/htdocs/templeet/fetch.php(215) : Warning - Cannot modify header information - headers already sent by (output started at /var/www/dev4.sociatomdev.com/chroot/htdocs/templeet/fetch.php:580) ==9772== ==9772== HEAP SUMMARY: ==9772== in use at exit: 60,706 bytes in 1,591 blocks ==9772== total heap usage: 1,822,108 allocs, 1,820,517 frees, 303,318,634 bytes allocated ==9772== ==9772== 21 (20 direct, 1 indirect) bytes in 1 blocks are definitely lost in loss record 27 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x845A07A: zend_assign_to_variable_reference (zend_execute.c:413) ==9772== by 0x84E558E: ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER (zend_vm_execute.h:27383) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 21 (20 direct, 1 indirect) bytes in 1 blocks are definitely lost in loss record 28 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x845B3E4: zend_assign_to_variable (zend_execute.c:714) ==9772== by 0x84D40A3: ZEND_ASSIGN_SPEC_CV_CONST_HANDLER (zend_vm_execute.h:24059) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 39 bytes in 3 blocks are possibly lost in loss record 46 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x840F685: _estrndup (zend_alloc.c:2525) ==9772== by 0x83F588F: zend_scan_escape_string (zend_language_scanner.l:740) ==9772== by 0x83F74AC: lex_scan (zend_language_scanner.l:2037) ==9772== by 0x841CEEE: zendlex (zend_compile.c:4954) ==9772== by 0x83EF882: zendparse (zend_language_parser.c:3280) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== ==9772== 40 bytes in 2 blocks are definitely lost in loss record 54 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x84CCA39: zend_send_by_var_helper_SPEC_CV (zend_vm_execute.h:22135) ==9772== by 0x84CD161: ZEND_SEND_VAR_SPEC_CV_HANDLER (zend_vm_execute.h:22242) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 54 (20 direct, 34 indirect) bytes in 1 blocks are definitely lost in loss record 65 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x845AAC6: zend_assign_to_object (zend_execute.c:558) ==9772== by 0x84D38B9: ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER (zend_vm_execute.h:23966) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 75 bytes in 12 blocks are possibly lost in loss record 73 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x840F685: _estrndup (zend_alloc.c:2525) ==9772== by 0x83F588F: zend_scan_escape_string (zend_language_scanner.l:740) ==9772== by 0x83F9834: lex_scan (zend_language_scanner.l:1870) ==9772== by 0x841CEEE: zendlex (zend_compile.c:4954) ==9772== by 0x83EF882: zendparse (zend_language_parser.c:3280) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== ==9772== 85 bytes in 11 blocks are possibly lost in loss record 77 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x840F685: _estrndup (zend_alloc.c:2525) ==9772== by 0x8402183: lex_scan (zend_language_scanner.l:1036) ==9772== by 0x841CEEE: zendlex (zend_compile.c:4954) ==9772== by 0x83EF882: zendparse (zend_language_parser.c:3280) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 92 (80 direct, 12 indirect) bytes in 4 blocks are definitely lost in loss record 82 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x845D63A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:300) ==9772== by 0x84612E1: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1606) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 100 bytes in 7 blocks are possibly lost in loss record 84 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x842CCDE: zend_str_tolower_dup (zend_operators.c:1884) ==9772== by 0x8414252: zend_do_begin_dynamic_function_call (zend_compile.c:1683) ==9772== by 0x8413D94: zend_do_begin_function_call (zend_compile.c:1575) ==9772== by 0x83F2378: zendparse (zend_language_parser.c:4652) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 100 bytes in 12 blocks are possibly lost in loss record 85 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x840F685: _estrndup (zend_alloc.c:2525) ==9772== by 0x83FA90D: lex_scan (zend_language_scanner.l:1672) ==9772== by 0x841CEEE: zendlex (zend_compile.c:4954) ==9772== by 0x83EF882: zendparse (zend_language_parser.c:3280) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 122 bytes in 9 blocks are possibly lost in loss record 90 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x840F685: _estrndup (zend_alloc.c:2525) ==9772== by 0x83F820E: lex_scan (zend_language_scanner.l:1695) ==9772== by 0x841CEEE: zendlex (zend_compile.c:4954) ==9772== by 0x83EF882: zendparse (zend_language_parser.c:3280) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 182 bytes in 14 blocks are possibly lost in loss record 100 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x840F685: _estrndup (zend_alloc.c:2525) ==9772== by 0x83F9637: lex_scan (zend_language_scanner.l:1817) ==9772== by 0x841CEEE: zendlex (zend_compile.c:4954) ==9772== by 0x83EF882: zendparse (zend_language_parser.c:3280) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 322 bytes in 34 blocks are possibly lost in loss record 112 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x842CCDE: zend_str_tolower_dup (zend_operators.c:1884) ==9772== by 0x8413D39: zend_do_begin_function_call (zend_compile.c:1571) ==9772== by 0x83F2378: zendparse (zend_language_parser.c:4652) ==9772== by 0x83F517F: compile_file (zend_language_scanner.l:364) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 482 (144 direct, 338 indirect) bytes in 1 blocks are definitely lost in loss record 116 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x83F5086: compile_file (zend_language_scanner.l:334) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 613 (60 direct, 553 indirect) bytes in 3 blocks are definitely lost in loss record 117 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x84CCFF2: ZEND_SEND_REF_SPEC_CV_HANDLER (zend_vm_execute.h:22226) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 679 (120 direct, 559 indirect) bytes in 6 blocks are definitely lost in loss record 121 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x845B497: zend_assign_to_variable (zend_execute.c:724) ==9772== by 0x84DB447: ZEND_ASSIGN_SPEC_CV_TMP_HANDLER (zend_vm_execute.h:25697) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 14,467 (88 direct, 14,379 indirect) bytes in 2 blocks are definitely lost in loss record 135 of 136 ==9772== at 0x4023F50: malloc (vg_replace_malloc.c:236) ==9772== by 0x840F2D1: _emalloc (zend_alloc.c:2370) ==9772== by 0x8423FFC: zend_rebuild_symbol_table (zend_execute_API.c:1699) ==9772== by 0x845B588: zend_get_target_symbol_table (zend_execute.c:766) ==9772== by 0x846082C: zend_fetch_var_address_helper_SPEC_CONST (zend_vm_execute.h:1340) ==9772== by 0x8460EA0: ZEND_FETCH_R_SPEC_CONST_HANDLER (zend_vm_execute.h:1424) ==9772== by 0x845CE46: execute (zend_vm_execute.h:107) ==9772== by 0x8430173: zend_execute_scripts (zend.c:1194) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== 17,328 bytes in 1 blocks are possibly lost in loss record 136 of 136 ==9772== at 0x4024046: realloc (vg_replace_malloc.c:525) ==9772== by 0x840F392: _erealloc (zend_alloc.c:2391) ==9772== by 0x8425C72: pass_two (zend_opcode.c:380) ==9772== by 0x83F51DB: compile_file (zend_language_scanner.l:376) ==9772== by 0x8265A34: phar_compile_file (phar.c:3393) ==9772== by 0x83AEE26: xc_check_initial_compile_file (xcache.c:929) ==9772== by 0x84300D3: zend_execute_scripts (zend.c:1186) ==9772== by 0x83C70C8: php_execute_script (main.c:2268) ==9772== by 0x84F4A3A: main (cgi_main.c:2109) ==9772== ==9772== LEAK SUMMARY: ==9772== definitely lost: 592 bytes in 21 blocks ==9772== indirectly lost: 15,877 bytes in 524 blocks ==9772== possibly lost: 18,353 bytes in 103 blocks ==9772== still reachable: 25,884 bytes in 943 blocks ==9772== suppressed: 0 bytes in 0 blocks ==9772== Reachable blocks (those to which a pointer was found) are not shown. ==9772== To see them, rerun with: --leak-check=full --show-reachable=yes ==9772== ==9772== For counts of detected and suppressed errors, rerun with: -v ==9772== ERROR SUMMARY: 18 errors from 18 contexts (suppressed: 38 from 11)