News Feed
Sections




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

Joshua Thijssen:
PHP's Resources and garbage collection
July 12, 2013 @ 10:54:34

Joshua Thijssen has put together a new post with details about garbage collection in PHP and a "nice bug/feature/whatsmathing" he found related to it and its performance.

I was playing around with writing a daemon and if you have any experience writing daemons (in any language), there are a few rules you have to live by. For instance, setting your effective uid and gid to a non-privileged user (in case you needed to do some privileged initialization, like opening a socket on a tcp port < 1024), setting the process as a group leader with posix_setsid(), and redirecting stdio file descriptions. And here something went wrong which took a while to find and fix..

He was creating a daemon and the script would just exit without a warning and not continue running. He narrowed down the issue to a few lines (with fopen and fclose) and went to debug it with strace to really see what was happening. He found some unexpected calls in the stack trace and, after some more digging, finally figured out it was a problem of both scope and cleanup that was resulting in the extra calls.

0 comments voice your opinion now!
garbage collection resource stdin stdout stderr bug

Link: http://www.adayinthelifeof.nl/2013/07/10/phps-resources-and-garbage-collection

blog comments powered by Disqus

Similar Posts

Matthew Weier O'Phinney's Blog: Creating Re-Usable Zend_Application Resource Plugins

Jani Hartikainen's Blog: Zend_Acl part 2: different roles and resources, more on access

Chris Jones' Blog: Oracle Database and Instant Client 11.2.0.2 are available on Linux

Ilia Alshanetsky\'s Blog: PHP 5.1.2RC2 Released!

Community News: Windows Software Tools for PHP Wants Beta Testers


Community Events





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


developer community list framework podcast code opinion wordpress release interview refactor unittest configure install introduction series laravel threedevsandamaybe testing language

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