php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46115 Memory leak when calling a method using Reflection
Submitted: 2008-09-18 14:36 UTC Modified: 2008-09-19 12:49 UTC
From: felipe@php.net Assigned: dmitry
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-09-18 (CVS) OS:
Private report: No CVE-ID:
 [2008-09-18 14:36 UTC] felipe@php.net
Description:
------------
zend_execute_API.c:903 -> ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
zend_interfaces.c:51 -> fci.retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval
zend_execute_API.c:699 -> *fci->retval_ptr_ptr = NULL;

Reproduce code:
---------------
<?php

$x = new reflectionmethod('RecursiveArrayIterator', 'asort');
$x->invoke(new RecursiveArrayIterator(array()));

Actual result:
--------------
==16579== 20 bytes in 1 blocks are definitely lost in loss record 2 of 4
==16579==    at 0x4021620: malloc (vg_replace_malloc.c:149)
==16579==    by 0x838C7DF: zend_call_function (zend_execute_API.c:903)
==16579==    by 0x81B101F: zim_reflection_method_invoke (php_reflection.c:2510)
==16579==    by 0x83B8992: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:315)
==16579==    by 0x83B74EB: execute (zend_vm_execute.h:104)
==16579==    by 0x8397006: zend_execute_scripts (zend.c:1197)
==16579==    by 0x83457F7: php_execute_script (main.c:2080)
==16579==    by 0x841F542: main (php_cli.c:1130)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-19 12:49 UTC] dmitry@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 18:01:53 2014 UTC