Skip Menu |

This queue is for tickets about the Marpa-R2 CPAN distribution.

Report information
The Basics
Id: 87386
Status: resolved
Priority: 0/
Queue: Marpa-R2

People
Owner: jkegl [...] cpan.org
Requestors: jvverde [...] gmail.com
Cc: AMON [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.065_006



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?
Fixed in Marpa-R2 2.065_006. The problem turned out to be a circular reference in the Perl code. Thanks for finding this issue, and thanks to amon for the minimal example, which was a big help in testing and saved me time.
Subject: Re: [rt.cpan.org #87386] Marpa::R2 leaks memory
Date: Wed, 31 Jul 2013 17:08:49 +0100
To: bug-Marpa-R2 [...] rt.cpan.org
From: Isidro Vila Verde <jvverde [...] gmail.com>
On 07/31/2013 04:41 PM, Jeffrey Kegler via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=87386 > > > Fixed in Marpa-R2 2.065_006. The problem turned out to be a circular reference in the Perl code. Thanks for finding this issue, and thanks to amon for the minimal example, which was a big help in testing and saved me time.
Thank you for your quick answer and fixed. Isidro