我正在使用最新版本的 marpa::r2 (Marpa-R2-2.065_002),它似乎很快就吃光了所有内存。我写了下面的脚本来测试它。
use strict;
use warnings FATAL => 'all';
use Marpa::R2;
use Data::Dumper;
my $grammar = Marpa::R2::Scanless::G->new({
action_object => __PACKAGE__,
source => \(<<'END_OF_SOURCE'),
:default ::= action => ::array
:start ::= path
path ::=
step action => _do_step
step ~ [a-z]+
END_OF_SOURCE
});
sub _do_step{ return {step => $_[1]}};
sub new {} #The Marpa::R2 needs it
sub compile{
my ($query) = @_;
return undef unless $query;
my $reader = Marpa::R2::Scanless::R->new({
grammar => $grammar,
trace_terminals => 0,
});
$reader->read(\$query);
print Dumper $reader->value;
}
compile($_) foreach ('aaaa'..'zzzz');
我能做些什么来防止内存泄漏?
编辑:这现在被报告为rt.cpan的错误。
编辑:现在已在 Marpa-R2 2.066000 版本中修复。谢谢