Re: [SOAP] Memory usage

From: Date: Fri, 21 Mar 2003 21:03:15 +0000
Subject: Re: [SOAP] Memory usage
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-499@lists.php.net to get a copy of this message
On Wednesday, March 19, 2003, at 03:04 PM, Lukas Smith wrote:
I've noticed high memory usage when running the soap interop tests.
My
assumption is that somewhere objects are not being passed by reference and copies are getting created. With limited time on my hands, and
PHP
5 looming (with features I want for soap) I haven't bothered tracking down what is going on. Shane
I don't know the specific code you are talking about. But if its PHP code than using pass by reference will actually slow down your application as odd as it may sound. This is due to the fact how intelligent PHP4 handles assigning values to a variable via a reference counter.
However, if the object being passed is manipulated, then PHP creates an in memory copy of the object. This not only slows down the application, but it uses a huge chunk of memory (which is what Shane is referring to). Since PEAR SOAP (and SOAP libraries in general) reference a lot of objects (the "O" in SOAP), it is probably best to replace all parameter passing of objects with references. Also, it is best to make sure all creation operations ("new" or factories) are pass by reference. Unfortunately, there may be some unanticipated side effects for doing this. PHP 5 treats all objects as a reference into a global objects table, so this no longer is an issue. That is what I believe Shane was referring to. Also, how much a performance loss? From what I remember, the cost of passing a simple type by reference is around 10% (not much). Take care, terry -- terry chay <mailto:tychay@mac.com> <http://homepage.mac.com/tychay/> Software Engineer, MyCasaNetwork, Inc. <http://www.mycasanetwork.com/>

Attachment: [text/directory] terry chay.vcf
« previous php.soap (#499) next »