Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12328 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25575 invoked by uid 1010); 24 Aug 2004 16:55:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 25047 invoked from network); 24 Aug 2004 16:55:26 -0000 Received: from unknown (HELO mail.communityconnect.com) (209.10.169.57) by pb1.pair.com with SMTP; 24 Aug 2004 16:55:26 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.communityconnect.com (Postfix) with ESMTP id 041036F618; Tue, 24 Aug 2004 12:59:32 -0400 (EDT) Received: from mail.communityconnect.com ([127.0.0.1]) by localhost (cc18-2.web.gbx.ccops.us [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18797-06; Tue, 24 Aug 2004 12:59:21 -0400 (EDT) Received: from [192.168.101.34] (cc240-0.web.gbx.ccops.us [10.30.0.240]) by mail.communityconnect.com (Postfix) with ESMTP id D36F46F5B0; Tue, 24 Aug 2004 12:59:20 -0400 (EDT) Reply-To: john@coggeshall.org To: ilia@prohost.org Cc: internals@lists.php.net, Jason In-Reply-To: <200408241153.56659.ilia@prohost.org> References: <20040824122859.1826.qmail@web11002.mail.yahoo.com> <200408241153.56659.ilia@prohost.org> Content-Type: text/plain Message-ID: <1093366416.12199.42.camel@unix-101-34.hq.communityconnect.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Tue, 24 Aug 2004 12:53:36 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mail.communityconnect.com Subject: Re: [PHP-DEV] preg leak From: john@coggeshall.org (John Coggeshall) Shouldn't you be able to disable that cache though? John On Tue, 2004-08-24 at 11:53, Ilia Alshanetsky wrote: > This is not a bug, but rather expected behavior. PCRE extension caches > compiled regular expressions so that subsequent runs of the same regex do not > need to perform the compilation step. In your example you are generating new > regex in an unterminated loop, so it's no surprise that PHP eventually > exhausts the available memory and terminates. > > Ilia > > On August 24, 2004 08:28 am, Jason wrote: > > Hi guys, > > > > I'm looking for the maintainer of the preg_match > > function in PHP. There appears to be a nasty leak in > > its most basic functionality, and being a very > > fundamental function of PHP (not to mention that my > > long running scripts use it a lot ;) I thought I'd try > > and go the direct route. Sorry, I don't know C or I'd > > try to fix it myself! Considering its nature I > > thought best to at least make a post to the list > > rather than it get lost in the bugs pile (the original > > (much less refined) report from someone else had been > > sitting a long time). > > > > > while (1) { > > $body = "any string"; > > $rand = "any different > > strings".mt_rand(0,mt_getrandmax()); > > $pattern = "/$rand/"; > > preg_match($pattern, $body, $match); > > } > > ?> > > > > http://bugs.php.net/bug.php?id=28513 > > > > This leaks 50MB per second on my PHP5.0.0,5.0.1. It > > is probably the similar bug reported in PHP4. If you > > have any suggestions, please let me know! > > > > Sincere regards, > > > > Jason. > > > > > > > > > > _______________________________ > > Do you Yahoo!? > > Win 1 of 4,000 free domain names from Yahoo! Enter now. > > http://promotions.yahoo.com/goldrush