in reply to Re: Re: RegEx on 4MB file consumes of 2GB of ram before windows shuts it down (Memory Leak in 5.8.2)
in thread RegEx on 4MB file consumes of 2GB of ram before windows shuts it down (Memory Leak in 5.8.2)

You don't parse self referential nested trees with simple REs. You parse them with a parser (typically recursive descent) and then work over the nodes.

Regardless of that the code I supplied does the same as the regexes you were trying to use in your original post except a lot more efficiently. You seem to have missed what it does. Also you seem happy to blame a memory leak in the RE engine. Besides the fact that your REs are really rather badly written I pointed out you have an extra set of braces:

while(<>) { { # surplus to requirements

this may well be creating a closure.

cheers

tachyon

  • Comment on Re: Re: Re: RegEx on 4MB file consumes of 2GB of ram before windows shuts it down (Memory Leak in 5.8.2)
  • Download Code