Subject: | Marpa::R2 leaks memory |
Date: | Sun, 28 Jul 2013 23:51:12 +0100 |
To: | bug-Marpa-R2 [...] rt.cpan.org |
From: | Isidro Vila Verde <jvverde [...] gmail.com> |
Hello,
I think there are a memory leak on this module. Bellow is a copy of a
message that I posted on stackoverflow
(http://stackoverflow.com/questions/17912742/marpar2-leaks-memory) an
then someone mention this way to report the bug.
Thank you very much!
Isidro
I am using latest release of marpa::r2 (Marpa-R2-2.065_002) and it seems
to eat all memory very fast. I wrote the bellow script to test it.
--------------------------------------------
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');
----------------------------------------
What can I do to prevent the memory leaks?