|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-03-12 21:48 UTC] Jason at hspace dot net
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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |
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...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.