Re: Matching multiple subexpressions in a regular expression
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Thu, 13 Mar 2008 23:25:58 GMT
"S" == ShaunJ <sjackman@xxxxxxxxx> writes:
S> On Mar 13, 2:28 pm, xhos...@xxxxxxxxx wrote:
>> ShaunJ <sjack...@xxxxxxxxx> wrote:
>> > Hi John,
>>
>> > If I structure my program as in the example, using many small regex
>> > instead of one big regex, Perl 5.8.6 runs out of memory and dies:
>> > vm_allocate failed, Out of memory! I have 400'000 regex of exactly 27
>> > characters each, and the input string is one line 100 kB long. The
>> > machine has 2 GB of memory and free disk space, which should be
>> > enough, so I presume the code is somehow leeking memory. It's only a
>> > dozen or so lines long, so I've posted my code below. Can you see an
>> > obvious leak?
>>
>> > Thanks,
>> > Shaun
>>
>> > my @restrings = <REFILE>;
>> > my @re = map { qr/$_/x } @restrings;
>> > while (<>) {
>>
>> ...
>>
>> Can you produce a version that we can run? (I.e. that doesn't
>> depend on REFILE or STDIN, which we don't have access to?)
S> Yes, see the recent thread 'm// on very long lines leaks memory',
S> where I gave a small test case. As it turns out, there is a bug in
S> Perl 5.8.6 (which is shipped with MacOSX 10.4.11 incidentally). Using
S> either English or $& causes the memory leak. This bug is fixed in
S> 5.10.0.
it is not a leak (as someone else proved in another post). so don't go
blabbing that it is a leak. it is a well known ram suck but it doesn't
lose the ram like a true leak does.
uri
--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Architecture, Development, Training, Support, Code Review ------
----------- Search or Offer Perl Jobs ----- http://jobs.perl.org ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.
- References:
- Matching multiple subexpressions in a regular expression
- From: ShaunJ
- Re: Matching multiple subexpressions in a regular expression
- From: John W. Krahn
- Re: Matching multiple subexpressions in a regular expression
- From: ShaunJ
- Re: Matching multiple subexpressions in a regular expression
- From: xhoster
- Re: Matching multiple subexpressions in a regular expression
- From: ShaunJ
- Matching multiple subexpressions in a regular expression
- Prev by Date: Re: m// on very long lines leaks memory
- Next by Date: FAQ 5.31 How can I tell whether there's a character waiting on a filehandle?
- Previous by thread: Re: Matching multiple subexpressions in a regular expression
- Next by thread: Re: Matching multiple subexpressions in a regular expression
- Index(es):
Relevant Pages
|