Skip Menu |

This queue is for tickets about the Parse-BBCode CPAN distribution.

Maintainer(s)' notes

If you have any wishes, feel free to create a ticket.

Plans:

I would like to add callbacks to the parser so that you can gather some information about specific tags and ideally can manipulate them during parsing.

But there are already enough informations to create a download link for code tags, for example. See example/code_download.pl.

Parse::BBCode is now hosted on github, so for bug reports also check https://github.com/perlpunk/Parse-BBCode

Report information
The Basics
Id: 54815
Status: resolved
Priority: 0/
Queue: Parse-BBCode

People
Owner: Nobody in particular
Requestors: njahnke [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.09
Fixed in: 0.10



Subject: memory leak in render()?
#!/usr/bin/perl -w use strict; use Parse::BBCode; my $p = Parse::BBCode->new(); my $code = 'some [b]b code[/b]'; while (1) { my $parsed = $p->render($code); } __END__ memory usage is 100s of megabytes within seconds. perl v5.10.0 built for x86_64-linux-gnu-thread-multi Linux 2.6.26-2-amd64 #1 SMP Thu Nov 5 02:23:12 UTC 2009 x86_64 GNU/Linux debian lenny stable sorry, i don't have time right now to find the bug myself ...
From: njahnke [...] gmail.com
i worked on this a bit tonight. i found that if i add: undef $callback_found_tag; ... right before the return at the end of parse(), then the memory leak in my example code goes away. i suspect that it is because of calls to $callback_found_tag->() inside the same coderef. hope this helps!
On 2010-03-10 00:21:47, njahnke wrote: Show quoted text
> i worked on this a bit tonight. i found that if i add: > > undef $callback_found_tag; > > ... right before the return at the end of parse(), then the memory leak > in my example code goes away. i suspect that it is because of calls to > $callback_found_tag->() inside the same coderef. > > hope this helps!
Thank you. I run into the same problem and the workaround really helps. Regards, Slaven
Am Fr 19. Feb 2010, 20:46:37, njahnke schrieb: Show quoted text
> #!/usr/bin/perl -w > > use strict; > > use Parse::BBCode; > my $p = Parse::BBCode->new(); > my $code = 'some [b]b code[/b]'; > while (1) { > my $parsed = $p->render($code); > } > > __END__ > > > memory usage is 100s of megabytes within seconds. > > perl v5.10.0 built for x86_64-linux-gnu-thread-multi > > Linux 2.6.26-2-amd64 #1 SMP Thu Nov 5 02:23:12 UTC 2009 x86_64 GNU/
Linux Show quoted text
> > debian lenny stable > > > sorry, i don't have time right now to find the bug myself ...
Thanks for your report, I'll have a look as soon as possible, hopefully this week I can release a new version.
Am Mi 10. Mär 2010, 00:21:47, njahnke schrieb: Show quoted text
> i worked on this a bit tonight. i found that if i add: > > undef $callback_found_tag; > > ... right before the return at the end of parse(), then the memory
leak Show quoted text
> in my example code goes away. i suspect that it is because of calls to > $callback_found_tag->() inside the same coderef. > > hope this helps!
Ok, I uploaded version 0.10, thanks very much for looking into this! I used Scalar::Util::weaken and additionally (if S::U is not installed) I set the variable to undef.