 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Better Understanding PHP's Garbage Collection
by Chris Cornutt July 12, 2012 @ 11:10:22
If you've been working with PHP for any length of time, you probably have wondered what happens to everything you've created when your script's execution ends. Well, in this new post from PHPMaster.com PHP's garbage handling functionality.
It's interesting how just a few years can make a difference in the names that are given to things. If this were to come up today, it would probably be called PHP Recycling Options, because rather than picking things up and throwing them into a landfill where they'll never be seen again, we are really talking about grabbing things whose use has passed and setting them up to be useful again. But, recycling wasn't le petit Cherie of society back when the idea was developed and so this task was given the vulgar name of 'Garbage Collection'. What can we do but follow what history and common usage have given us?
They talk about a few different kinds of data that the garbage collection system cleans up including the program-generated information and the three tiered system the languages for cleanup:
- First Level - End of Scope
- Second Level - Reference Counting
- Third Level - Formal Garbage Collection
voice your opinion now!
garbage collection tutorial introduction
PHPMaster.com: An Intro to Virtual Proxies, Part 2
by Chris Cornutt April 26, 2012 @ 09:24:23
Following up on his previous article, Alejandro Gervasio has a new post to PHPMaster.com with the second part of his series on using virtual proxies in PHP.
Resting on the foundation of Polymorphism (dynamic Polymorphism, not the ad-hoc one often achieved through plain method overriding), Virtual Proxies are a simple yet solid concept which allows you to defer the construction/loading of expensive object graphs without having to modify client code.
He shows how to create a collection of domain objects that use proxies to populate their data. He includes the code for creating a "Post" interface/object as well as a Comment interface/object. These are put into a "CommentCollection" and, when it's accessed, pull the item in the collection out, only populating the data on demand.
voice your opinion now!
virtual proxies introduction series collection domain object
Chris Hartjes' Blog: PHPUnit Aborted Fix
by Chris Cornutt January 19, 2012 @ 11:16:53
Chris Hartjes ran into an issue with hit unit tests where PHPUnit was throwing an "aborted" error no matter what tests were run. Thankfully, in this new post, he shares a solution.
That was a pretty annoying bug. I never did find out what the problem was as I moved onto other problems and chalked that error up to some undiagnosed weirdness on that particular server. From time to time I would get asked on Twitter if I had ever solved the problem. My answer was always "no, and if you do solve it please let met know how you fixed it." Today, my friends, was the day.
Based on a response from Demian Katz, he was able to get around the issue with flag set on the PHPUnit command line - "-dzend.enable_gc=0". Apparently the issue has to do with garbage collection and has been a known issue since the beginning of 2011.
voice your opinion now!
phpunit aborted unittest fix garbage collection bug
Derick Rethans' Blog: Collecting Garbage Performance Considerations
by Chris Cornutt September 13, 2010 @ 11:22:42
Derick Rethans has posted the third part of his series looking at the garbage collection handling in PHP (the first two parts are here: one, two). In this last part of the series, he'll look at some of the possible performance impacts the garbage collection functionality can have in your applications.
In the previous two parts of this column we have explored PHP's take on circular referenced variables and a mechanism that allows to clean up this particular problem with reference counted variable tracking. Of course, the implementation of the garbage collection mechanism in PHP 5.3 has some performance impacts. In this third and last part of the column I will cover the performance implications of the addition of this garbage collection mechanism.
He looks at the two possible places that the collection could have an impact - memory usage and run-time delays when the garbage collection routine is fired off and does its job. As before, each of the topics is accompanied by bits of code and a few graphs showing the differences between handling in PHP 5.2 and PHP 5.3 as well as a handy way to get a bit more information out of PHP (using the GC_BENCH CFLAG when compiling).
,/p>
voice your opinion now!
garbage collection performance memory usage runtime delay
Derick Rethans' Blog: Collecting Garbage Cleaning Up
by Chris Cornutt September 07, 2010 @ 09:56:25
Derick Rethans has continued his series on garbage collection in the PHP internals with this second post of the series with a special look at circular references. You can find the first part here.
In this second part of the three part column on the new garbage collecting mechanism in PHP 5.3, we'll dive into a solution to the problem with circular references. If we look quickly back, we found that by using code like the [first example], an in-request memory leak is created.
He goes on to briefly describe the synchronous algorithm (including a few more helpful graphs to show the flow) and how that has worked its way into the PHP garbage collection methods. He also points out that this collection can be turned off and on via the gc_enable and gc_disable functions. Keep an eye out for the next part of the series where he gets into more detail on how this is all integrated into PHP.
voice your opinion now!
garabage collection article phparchitect circular references
Derick Rethans' Blog: Collecting Garbage PHP's take on variables
by Chris Cornutt August 31, 2010 @ 10:49:11
Derick Rethans is republishing an article series he wrote (originally for php|architect) about the garbage collection that is included with the PHP 5.3 releases. He kicks off the series with this first post introducing internal variable handling.
Before we start with the intricate details of PHP's new GC engine I will explain why it is actually needed. This, combined with an introduction how PHP deals with variables in general is explained in this first part of the column. The second part will cover the solution and some notes on the GC mechanism itself, and the third part covers some implications of the GC mechanism, as well as some benchmarks. But now first on to the introduction.
He introduces the concept of a "zval" - the container PHP uses internally to handle variables (along with its "is_ref" and "refcount" to tell the interpreter if it's a reference or not). He also shows how these relate to the variables you set in your applications as well as a mention of the xdebug_debug_zval function of XDebug to show how it's handled behind the scenes. He also shows how references are handled with accompanying images to show the flow. If you'd like more information on variable handling, Derick points to this article for more detail.
voice your opinion now!
garbage collection variable introduction zval reference xdebug
Brandon Savage's Blog: Taking A Look At Propel 1.5
by Chris Cornutt February 25, 2010 @ 13:14:30
In a recent post to his blog Brandon Savage evaluates Propel (ORM) to see what it has to offer him and his applications.
I've liked Propel ever since I started working with it in the middle of last year; I personally find it easier and more fun to use than Doctrine or other ORMs available today. I was excited to see recently that Propel's development team had released Propel 1.5 as a beta, with a launch of the new features to come soon.
He points out two of the newer features that he particularly likes - collections and on-demand hydration and model queries. The first lets you hydrate the results fetched as you need them instead of all at once and the second does away with some of the issues that came up with making Criteria objects. You can find out more about these and other new features on the Propel "What's New" page.
voice your opinion now!
propel orm feature collection hydration model query
Adam Gotterer's Blog: Building an Object Collection Manager with the Standard PHP Library (SPL)
by Chris Cornutt November 02, 2009 @ 09:17:14
Adam Gotterer has written up a tutorial with his process behind creating an object collection manager with PHP's built-in SPL functionality.
The purpose of a collection is to store objects in an organized manner with specific access rules. We are going to build a collection class using the Standard PHP Library (SPL). Our final product will be capable of iterating, counting and access to objects via array. If you are not familiar with SPL you can find some additional information on the PHP SPL manual site. Unfortunately the manual is somewhat lacking.
He creates an object that implements the ArrayAccess, Countable and Iterator objects to create a "Collection" class to hold his multiple objects inside an"objects" array. He includes some code to test the class and the output as a result.
voice your opinion now!
object collection manager spl tutorial
|
Community Events
Don't see your event here? Let us know!
|