Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7322 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52248 invoked by uid 1010); 25 Jan 2004 01:08:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 52192 invoked from network); 25 Jan 2004 01:08:31 -0000 Received: from unknown (HELO miranda.org) (209.58.150.153) by pb1.pair.com with SMTP; 25 Jan 2004 01:08:31 -0000 Received: (qmail 20878 invoked by uid 546); 25 Jan 2004 01:08:31 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 25 Jan 2004 01:08:31 -0000 Date: Sat, 24 Jan 2004 20:08:31 -0500 (EST) X-X-Sender: adam@miranda.org To: Marcus Boerger cc: internals@lists.php.net In-Reply-To: Message-ID: References: <127-1489258859.20040123221414@marcus-boerger.de> <4-1484044703.20040123234108@marcus-boerger.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] SPL Examples Broken? From: adam@trachtenberg.com (Adam Maccabee Trachtenberg) On Sat, 24 Jan 2004, Adam Maccabee Trachtenberg wrote: > On Fri, 23 Jan 2004, Marcus Boerger wrote: > > > Fixed too. Hey if you find some cool & easy examples please tell me. > > Thanks for the fix. I'll let you know when I come up with something > cool. :) I have another example for you to check out. This one works correctly, but leaks memory. Assume this is setup like findfile.php: class RegexFindFile extends FindFile { function accept() { return preg_match($this->file, $this->current()); } } foreach(new RegexFindFile($argv[1], $argv[2]) as $pathname => $file) echo $file->getPathname()."\n"; [adam@benlev:~/CVS/php/php-src/ext/spl/examples] $ php ./findfile.php . '/php$/' ./dba_array.php ./dba_dump.php ./directorytree.php ./findfile.php ./ini_groups.php ./tree.php /Users/adam/CVS/php/php-src/main/streams/streams.c(371) : Stream of type 'dir' 0xac81d0 (path:(null)) was not closed /Users/adam/CVS/php/php-src/main/streams/streams.c(371) : Stream of type 'dir' 0xac74a8 (path:(null)) was not closed /Users/adam/CVS/php/php-src/ext/spl/spl_directory.c(125) : Freeing 0x00AC7838 (6 bytes), script=./findfile.php Last leak repeated 1 time /Users/adam/CVS/php/php-src/main/streams/streams.c(215) : Freeing 0x00AC81D0 (132 bytes), script=./findfile.php /Users/adam/CVS/php/php-src/main/streams/plain_wrapper.c(872) : Actual location (location was relayed) Last leak repeated 1 time /Users/adam/CVS/php/php-src/ext/spl/spl_directory.c(93) : Freeing 0x00AC7D70 (1056 bytes), script=./findfile.php Last leak repeated 1 time /Users/adam/CVS/php/php-src/ext/spl/spl_directory.c(99) : Freeing 0x00AC7780 (32 bytes), script=./findfile.php /Users/adam/CVS/php/php-src/Zend/zend_hash.c(157) : Actual location (location was relayed) Last leak repeated 1 time /Users/adam/CVS/php/php-src/ext/spl/spl_directory.c(98) : Freeing 0x00AC7710 (44 bytes), script=./findfile.php Last leak repeated 1 time === Total 10 memory leaks detected === -adam -- adam@trachtenberg.com author of o'reilly's php cookbook avoid the holiday rush, buy your copy today!