DFA out of memory

775 views
Skip to first unread message

justinb

unread,
Aug 24, 2010, 12:11:57 PM8/24/10
to re2-dev
I have a very large regex that I'd like to use to test re2.
Unfortunately, I seem to have run up against a memory constraint:

-bash-3.00$ ./rec++
re2/dfa.cc:432: DFA out of memory: prog size 147268 mem 220695

How can I go about increasing the available memory for the DFA?

-justinb

Russ Cox

unread,
Aug 24, 2010, 12:24:48 PM8/24/10
to justinb, re2-dev

Initialize an RE2::Options structure using set_max_mem
and then pass it to the RE2 constructor.

Russ

justinb

unread,
Aug 24, 2010, 12:58:23 PM8/24/10
to re2-dev


On Aug 24, 10:24 am, Russ Cox <r...@swtch.com> wrote:
> On Tue, Aug 24, 2010 at 12:11 PM, justinb <tactileju...@gmail.com> wrote:
> > I have a very large regex that I'd like to use to test re2.
> > Unfortunately, I seem to have run up against a memory constraint:
>
> > -bash-3.00$ ./rec++
> > re2/dfa.cc:432: DFA out of memory: prog size 147268 mem 220695
>
> > How can I go about increasing the available memory for the DFA?
>
> Initialize an RE2::Options structure using set_max_mem
> and then pass it to the RE2 constructor.

Okay, cool, but now I get this:

Couldn't compile regular expression, skipping: due to error pattern
too large - compile failed. My (unoptimized) regex is 147264
characters. Can RE2 handle that?

Russ Cox

unread,
Aug 24, 2010, 3:06:18 PM8/24/10
to justinb, re2-dev
> Okay, cool, but now I get this:
>
> Couldn't compile regular expression, skipping:  due to error pattern
> too large - compile failed. My (unoptimized) regex is 147264
> characters. Can RE2 handle that?

Sure; give it more memory.

Russ

justinb

unread,
Aug 24, 2010, 4:51:58 PM8/24/10
to re2-dev
I'm up over 10MB now in the Options struct, and it still fails. pcre
seems to be fine with it, though, and is fast enough, so I suppose
that's what I'll use.
Reply all
Reply to author
Forward
0 new messages