PHP 4.0 Bug #9718 Updated: Memory leak when passing String values into methods through COM

From: Date: Wed, 21 Mar 2001 18:24:15 +0000
Subject: PHP 4.0 Bug #9718 Updated: Memory leak when passing String values into methods through COM
Groups: php.dev 
Request: Send a blank email to php-dev+get-49650@lists.php.net to get a copy of this message
ID: 9718 Updated by: phanto Reported By: Jason@hspace.net Old-Status: Open Status: Closed Bug Type: COM related Assigned To: Comments: fixed. Previous Comments: --------------------------------------------------------------------------- [2001-03-20 17:59:36] Jason@hspace.net I think that you've fixed the problem. Thanks. --------------------------------------------------------------------------- [2001-03-20 17:44:44] phanto@php.net could you try again with the latest cvs version. i've rewritten a lot. harald --------------------------------------------------------------------------- [2001-03-14 16:58:32] Jason@hspace.net On that note, changing code to below also leaks memory. Variables html_example_test01, etc are declared as public static variables in the COM component. Methods set_html_example_test01() etc set the static variables to the string values passed through the argument. <? Code block sets all public static variables $gbl_obj->set_html_example_test01("Test string #01."); $gbl_obj->set_html_example_test02("Test string #02."); $gbl_obj->set_html_example_test03("Test string #03."); $gbl_obj->set_html_example_test04("Test string #04."); $gbl_obj->set_html_example_test05("Test string #05."); $gbl_obj->set_html_example_test06("Test string #06."); $gbl_obj->set_html_example_test07("Test string #07."); $gbl_obj->set_html_example_test08("Test string #08."); $gbl_obj->set_html_example_test09("Test string #09."); $gbl_obj->set_html_example_test10("Test string #10."); $gbl_obj->set_html_example_test11("Test string #11."); $gbl_obj->set_html_example_test12("Test string #12."); $gbl_obj->set_html_example_test13("Test string #13."); $gbl_obj->set_html_example_test14("Test string #14."); $gbl_obj->set_html_example_test15("Test string #15."); $gbl_obj->set_html_example_test16("Test string #16."); $gbl_obj->set_html_example_test17("Test string #17."); $gbl_obj->set_html_example_test18("Test string #18."); $gbl_obj->set_html_example_test19("Test string #19."); $gbl_obj->set_html_example_test20("Test string #20."); // script does not leak memory when I remove this code block ?> I hope this clarifies the problem. Earlier examples weren't right as I have done lots of code with COM which work without leaking memory. --------------------------------------------------------------------------- [2001-03-14 16:46:18] Jason@hspace.net Disregard my previous example with the classes. I've just tried a test without using classes and it still leaks memory. Consider example below instead, thanks: Code block sets multiple public variables in COM object. In below example, $gbl_obj is an instance of the COM object in the global scope of the PHP page. The public variables are defined as html_example_test01, html_example_test02, html_example_test03, etc. etc. My code block sets over twenty public variables in the COM object. <? Code block sets all public variables in COM object $gbl_obj->html_example_test01 = "Test string #01."; $gbl_obj->html_example_test02 = "Test string #02."; $gbl_obj->html_example_test03 = "Test string #03."; $gbl_obj->html_example_test04 = "Test string #04."; $gbl_obj->html_example_test05 = "Test string #05."; $gbl_obj->html_example_test06 = "Test string #06."; $gbl_obj->html_example_test07 = "Test string #07."; $gbl_obj->html_example_test08 = "Test string #08."; $gbl_obj->html_example_test09 = "Test string #09."; $gbl_obj->html_example_test10 = "Test string #10."; $gbl_obj->html_example_test11 = "Test string #11."; $gbl_obj->html_example_test12 = "Test string #12."; $gbl_obj->html_example_test13 = "Test string #13."; $gbl_obj->html_example_test14 = "Test string #14."; $gbl_obj->html_example_test15 = "Test string #15."; $gbl_obj->html_example_test16 = "Test string #16."; $gbl_obj->html_example_test17 = "Test string #17."; $gbl_obj->html_example_test18 = "Test string #18."; $gbl_obj->html_example_test19 = "Test string #19."; $gbl_obj->html_example_test20 = "Test string #20."; // script does not leak memory when I remove this code block ?> I am using long variable names like html_example_test01 --------------------------------------------------------------------------- [2001-03-14 09:06:35] Jason@hspace.net 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... --------------------------------------------------------------------------- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9718&edit=2

« previous php.dev (#49650) next »