Re: Matching multiple subexpressions in a regular expression



"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 ---------
.



Relevant Pages

  • Re: allocatable non-dummy local variables and pointers to them
    ... My somewhat fualty memory says that the leak persisted. ... bugs would be a compiler bug. ... but the persistance would be an OS bug. ...
    (comp.lang.fortran)
  • Re: MDAC memory leak
    ... Most libraries place the decision of when to free ... There's a capability of breaking on a particular memory allocation, ... leak 500 objects, on the second test I leak 3, because I fixed the bug). ... "App shows memory leak on some machines." ...
    (microsoft.public.vc.mfc)
  • Re: MDAC memory leak
    ... Also when we used some of the memory leak tools suggested on microsoft site ... A mutex is a considerably less efficient synchronization ... "App shows memory leak on some machines." ...
    (microsoft.public.vc.mfc)
  • [PATCH] fix memory leak in mm/slab.c::alloc_kmemlist() (try #2)
    ... This should fix the leak and coverity bug #589 ... Currently the only caller of alloc_kmemlistwill BUG() if alloc_kmemlist ... be leaking memory when we return -ENOMEM. ...
    (Linux-Kernel)
  • Re: Memory leak in the Driver
    ... Paul G. Tobey wrote: ... driver development, it's most likely that you are at fault. ... The QFE has no impact on the leak but one thing is sure, ... i am sure that all the memory that i am allocating in my driver is ...
    (microsoft.public.windowsce.platbuilder)