RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_0) / zend_builtin_functions.czend_execute.c

From: Date: Mon, 18 Apr 2005 09:01:37 +0000
Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_0) / zend_builtin_functions.czend_execute.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3574@lists.php.net to get a copy of this message
Hi Jani, This leak exists only in PHP5. I found it because a lot of ext/soap test were failed, but the same leak can occur in any script with exceptions or backtrace function. The simplest reproduce case is follow: <?php class foo { function bar() { print_r(debug_backtrace()); } } $foo = new foo(); $foo->bar(); ?> Thanks. Dmitry. > -----Original Message----- > From: Jani Taskinen [mailto:sniper@iki.fi] > Sent: Monday, April 18, 2005 11:29 AM > To: Dmitry Stogov > Cc: zend-engine-cvs@lists.php.net > Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_0) / > zend_builtin_functions.czend_execute.c > > > > Doesn't this leak exist in PHP_4_3 branch..? And with > what code does it leak with? (test case..) > > --Jani > > > On Mon, 18 Apr 2005, Dmitry Stogov wrote: > > > dmitry Mon Apr 18 03:24:26 2005 EDT > > > > Modified files: (Branch: PHP_5_0) > > /ZendEngine2 zend_builtin_functions.c zend_execute.c > > Log: > > Fixed memory leak in debug_backtrace() > > > > > > > > http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1. > > 239.2.19&r2=1.239.2.20&ty=u > > Index: ZendEngine2/zend_builtin_functions.c > > diff -u ZendEngine2/zend_builtin_functions.c:1.239.2.19 > ZendEngine2/zend_builtin_functions.c:1.239.2.20 > > --- ZendEngine2/zend_builtin_functions.c:1.239.2.19 Mon Apr > 4 13:22:20 2005 > > +++ ZendEngine2/zend_builtin_functions.c Mon Apr 18 03:24:25 2005 > > @@ -17,7 +17,7 @@ > > > > > +------------------------------------------------------------- > ---------+ > > */ > > > > -/* $Id: zend_builtin_functions.c,v 1.239.2.19 2005/04/04 17:22:20 > > stas Exp $ */ > > +/* $Id: zend_builtin_functions.c,v 1.239.2.20 2005/04/18 07:24:25 > > +dmitry Exp $ */ > > > > #include "zend.h" > > #include "zend_API.h" > > @@ -1687,7 +1687,6 @@ > > char *function_name; > > char *filename; > > char *class_name; > > - char *call_type; > > char *include_filename = NULL; > > zval *stack_frame; > > void **cur_arg_pos = EG(argument_stack).top_element; > > @@ -1746,21 +1745,14 @@ > > zend_uint class_name_len; > > if > (Z_OBJ_HT_P(ptr->object)->get_class_name == NULL || > > > > Z_OBJ_HT_P(ptr->object)->get_class_name(ptr->object, > &class_name, &class_name_len, 0 TSRMLS_CC) != SUCCESS) { > > - > > - class_name = > Z_OBJCE(*ptr->object)->name; > > + > add_assoc_string_ex(stack_frame, "class", sizeof("class"), > Z_OBJCE(*ptr->object)->name, 1); > > + } else { > > + > add_assoc_string_ex(stack_frame, "class", sizeof("class"), > > +class_name, 0); > > } > > - call_type = "->"; > > + > add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", > > > +1); > > } else if > (ptr->function_state.function->common.scope) { > > - class_name = > ptr->function_state.function->common.scope->name; > > - call_type = "::"; > > - } else { > > - class_name = NULL; > > - call_type = NULL; > > - } > > - > > - if (class_name) { > > - > add_assoc_string_ex(stack_frame, "class", sizeof("class"), > class_name, 1); > > - > add_assoc_string_ex(stack_frame, "type", sizeof("type"), > call_type, 1); > > + > add_assoc_string_ex(stack_frame, "class", sizeof("class"), > ptr->function_state.function->common.scope->name, 1); > > + > add_assoc_string_ex(stack_frame, "type", sizeof("type"), "::", > > +1); > > } > > > > if ((! ptr->opline) || ((ptr->opline->opcode == > > ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == > ZEND_DO_FCALL))) { > > > http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.65 2.2.22&r2=1.652.2.23&ty=u > Index: ZendEngine2/zend_execute.c > diff -u ZendEngine2/zend_execute.c:1.652.2.22 ZendEngine2/zend_execute.c:1.652.2.23 > --- ZendEngine2/zend_execute.c:1.652.2.22 Mon Mar 21 11:22:10 2005 > +++ ZendEngine2/zend_execute.c Mon Apr 18 03:24:25 2005 > @@ -17,7 +17,7 @@ > > +----------------------------------------------------------------------+ > */ > > -/* $Id: zend_execute.c,v 1.652.2.22 2005/03/21 16:22:10 andi Exp $ */ > +/* $Id: zend_execute.c,v 1.652.2.23 2005/04/18 07:24:25 dmitry Exp $ > +*/ > > #define ZEND_INTENSIVE_DEBUGGING 0 > > @@ -258,7 +258,6 @@ > value_ptr->refcount = 1; > value_ptr->is_ref = 1; > } > - > *variable_ptr_ptr = value_ptr; > value_ptr->refcount++; > } else if (!variable_ptr->is_ref) { > > -- Donate @ http://pecl.php.net/wishlist.php/sniper -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.zend-engine.cvs (#3574) next »