[html-formfu] Possible leak with
Catalyst::Controller::HTML::FormFu
Octavian Rasnita
orasnita at gmail.com
Tue Mar 15 06:06:43 GMT 2011
From: "Charlie Garrison" <garrison at zeta.org.au>
Good afternoon,
While trying to plug some leaks in my app (using
CatalystX::LeakChecker to find them) some of the listed leaks
appear to have come from C::C::HTML::FormFu. I seem to recall
this being discussed here previously but I couldn't see any
fixes/patches for it in the git repo. I applied the following
patch and I'm not getting any more of the leaks I saw before.
diff --git a/lib/Catalyst/Controller/HTML/FormFu.pm
b/lib/Catalyst/Controller/HTML/FormFu.pm
index 04847fb..c1b069f 100644
--- a/lib/Catalyst/Controller/HTML/FormFu.pm
+++ b/lib/Catalyst/Controller/HTML/FormFu.pm
@@ -27,6 +27,8 @@ sub build_per_context_instance {
my ( $self, $c ) = @_;
$self->{c} = $c;
+ weaken( $self->{c} )
+ if !isweak( $self->{c} );
return $self;
}
I have reported that leak a long time ago and Carl answered with the same
solution, but I guess it was not applied to the H::FF trunk.
http://www.mail-archive.com/html-formfu@lists.scsys.co.uk/msg02195.html
Your solution is a little more complete though, because it also checks if
the reference is not weak.
Octavian
More information about the HTML-FormFu
mailing list