News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Alex Netkachov's Blog:
Optimize PHP memory usage eliminate circular references
September 18, 2007 @ 17:17:21

On his blog today, Alex Netkachov has posted a suggestion of how to combat a common issue facing PHP scripts - their memory usage.

PHP has a build-in garbage collector so you do not need to track the links on the objects, allocate memory for objects and delete them when they are not longer necessary. Things seem so perfect that developers do not even know that their scripts allocate a lot of memory until their server stops processing requests because of the out of memory error.

His example is the processing of a parent/child relationship tree. If not managed correctly, the variables being used could get out of hand quite quickly. Alex recommends the use of a "destructor" at the end of each iteration to help destroy variables and values no longer needed.

0 comments voice your opinion now!
optimize memory circular reference destructor variable optimize memory circular reference destructor variable


blog comments powered by Disqus

Similar Posts

Matthew Weir O'Phinney's Blog: Overloading arrays in PHP 5.2.0

Sebastian Bergmann\'s Blog: PHP - kurz & gut (Pocket Reference Update)

Matt Curry's Blog: Check Out These Upgrades I Made To The CakePHP DebugKit

Joshua Thijssen's Blog: Bloom Filters

Gonzalo Ayuso's Blog: Checking the performance of PHP exceptions


Community Events





Don't see your event here?
Let us know!


deployment tips conference list community podcast development framework language introduction api series release code developer version application laravel interview zendserver

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework