[PHP-DEV] PHP 4.0 Bug #9718 Updated: Memory leak when passing String values into methods through COM From: Jason <email protected>
Date: 03/14/01

ID: 9718
User Update by: Jason <email protected>
Status: Open
Bug Type: COM related
Description: Memory leak when passing String values into methods through COM

Corrections to bug report. Ignore previous example, check with the below example instead.

I'm actually assigning values from inside a child class in PHP and accessing the COM object in the base class.

eg:

<?php

class Child {
  function Child () {
    Base::instance();
    $this->obj->testvar = "This is a test string.";
  }
}

class Base {
  function instance() {
    $this->obj = new COM("MyObject.MyObject");
  }

}

?>

/ Leaks memory when I assign a string to a public variable (testvar) of COM object (obj) from an instance of Child.

Disregard my previous examples as I've tested my COM object with a simple string passed as argument to method and it did not leak memory.

I think the above memory leak has something to do with PHP's handling of Object Oriented Programming...

Previous Comments:
---------------------------------------------------------------------------

[2001-03-13 23:22:06] Jason <email protected>
Bug #9715 is reclassified under this bug.

> Memory leak when passing String value to a static variable in the COM object.
> Memory leak when passing String value as an argument in a method exposed by the COM object.

> I use VJ++ to write COM objects, as Java handles its own garbage collection.

Running php 4.0.5-dev ISAPI in IIS 5.0

---------------------------------------------------------------------------

[2001-03-12 22:18:49] Jason <email protected>
That wasn't it... I tried it without passing a constant, and it's still leaking memory! So this is an outstanding serious bug with no workaround.

---------------------------------------------------------------------------

[2001-03-12 21:57:39] Jason <email protected>
Found the problem.
It only leaks memory, if I pass a CONSTANT from PHP to the COM object.
All I have to do now is rewrite the php so that I'm passing a variable, not a constant.

Probably this issue can be closed after someone has a look into it.

---------------------------------------------------------------------------

[2001-03-12 21:48:59] Jason <email protected>
I added methods to pass String values into the static variables.
Passing String values into method in COM object also leaks memory.

Example:

COM object has method test(String a) and a static variable b
The method sets the variable b to a.

In PHP, I execute the COM object's method:

$t_obj->test("This is a test string.");

Memory leak when passing String into COM object.

---------------------------------------------------------------------------

Full Bug description available at: http://bugs.php.net/?id=9718

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>