[xdebug-dev] Bug 0000290: Function call leaks memory

From: <noreply[@]lists.xdebug.org>
Date: Sun, 8 Jul 2007 14:56:36 +0200

The following bug has been CLOSED
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000290
======================================================================
Reporter: Barro
Handler:
======================================================================
Project: Xdebug
Bug ID: 290
Category: Usage problems
Reproducibility: always
Severity: crash
Priority: normal
Status: closed
Operating System: Debian GNU/Linux testing/unstable
PHP Version: 5.2-dev
Xdebug Version: 2.0.0rc4
======================================================================
Date Submitted: 2007-07-03 20:30 CEST
Last Modified: 2007-07-08 14:56 CEST
======================================================================
Summary: Function call leaks memory
Description:
Xdebug leaks memory on every function call. A code to reproduce this
behaviour is in simplicity following:

<?php

$a = 'foo';

function bar($a)
{
    $b = $a;
}

for ($i = 0; $i < 10000000; $i++) {
    bar($a);
}

?>

Execute that and watch the memory usage climb for example using "top"
command (and noticing disk swapping if you don't do anything).

Xdebug version xdebug-2.0.0RC4
PHP-version 5.2.3

Both PHP and Xdebug are compiled directly from sources and default
settings are used in both to make sure that the ones included in Debian
don't interfere with testing.

This also happens on a few other machines with Ubuntu Feisty installed (by
using the PHP version 5.2.1 that is in it).
======================================================================

----------------------------------------------------------------------
 derick - 2007-07-07 23:09 CEST
----------------------------------------------------------------------
I've a fix for this, but I can not commit this as my CVS server is off
line. I will commit as soon as this is up. For now, you could apply the
following patch yourself:

--- xdebug.c.orig 2007-07-07 23:08:54.000000000 +0200
+++ xdebug.c 2007-07-07 23:05:50.000000000 +0200
@@ -1332,7 +1332,9 @@
                return;
        }
 
- XG(context).program_name = xdstrdup(op_array->filename);
+ if (!XG(context).program_name) {
+ XG(context).program_name = xdstrdup(op_array->filename);
+ }
 
        if (XG(level) == 0) {
                /* Set session cookie if requested */

----------------------------------------------------------------------
 derick - 2007-07-08 14:56 CEST
----------------------------------------------------------------------
Fixed in CVS.

Bug History
Date Modified Username Field Change
======================================================================
2007-07-03 20:30Barro New Bug
2007-07-03 20:30Barro Bug Monitored: Barro
2007-07-07 23:09derick Bugnote Added: 0000680
2007-07-08 14:56derick Bugnote Added: 0000684
2007-07-08 14:56derick Status new => closed
======================================================================
Received on Sun Jul 08 2007 - 14:56:39 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST