Andrei already fixed it. -Rasmus
On Tue, 24 Aug 2004, Jason wrote: > Thanks for the feedback. > > A way to somehow limit the caching of expressions > would be ideal, otherwise, the memory is lost forever > with no way to reclaim it. I imagine a limited size > cache which keeps only the most used expressions would > be ideal. > > If anyone can tell me which source file has the > 'caching' code in it that would be very appreciated. > > Jase > > --- Ron Korving <[EMAIL PROTECTED]> wrote: > > > FIFO, with the addition that one that's re-used, > > will be moved to the > > beginning of the list, would (I think) greatly > > benefit the cache hit-rate. > > > > Just my $0.02 > > > > Ron > > > > "Derrell Lipman" > > <[EMAIL PROTECTED]> wrote in > > message > > news:[EMAIL PROTECTED] > > > Ilia Alshanetsky <[EMAIL PROTECTED]> writes: > > > > > > > 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. > > > > > > Since PHP never knows what the user might do or > > how long the application > > might > > > run for, perhaps the cache, a useful feature in > > this case, should have a > > > maximum cache size. If the maximum cache size is > > exceeded, the oldest > > > (ideally) cached compiled regexp would be deleted > > from the cache. > > > > > > It's probably reasonable to keep only a very small > > number of compiled > > regular > > > expressions in cache. Intuition, at least, tells > > me that if a regular > > > expression isn't reused "soon" the compile time is > > likely not a big deal. > > > > > > I'm guessing that the regular expressions are > > maintained in such an order > > that > > > the requested one can be found quickly (via a > > hash? binary search?). > > Given > > > my earlier assumption that only a small number > > really need be cached, they > > > could instead be kept in FIFO order, and a simple > > linear search of the > > (small) > > > list done to see if the requested regexp is > > cached. When it's not found, > > the > > > one at tail of the queue (assuming the queue is > > full) would be deleted to > > make > > > room for a new one which would be pushed onto the > > head of the queue. > > > > > > Since my assumption is based purely on intuition, > > is there any indication > > from > > > "real life" that in fact, keeping many regexps in > > the cache is truly > > > beneficial? > > > > > > Cheers, > > > > > > Derrell > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail is new and improved - Check it out! > http://promotions.yahoo.com/new_mail > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php