#794598 Creates circular reference to Catalyst context leading to memory leak

#794598#5
Date:
2015-08-04 19:15:38 UTC
From:
To:
CatalystX::LeakChecker found a circular reference in my app. The below
patch appears to fix, and doesn't seem to break anything...

I think this is caused by the Plack changes in Catalyst 5.9, but I
wasn't able to test if it happened on older versions of Catalyst as
well.

diff --git a/lib/Catalyst/Controller/FormBuilder/Action.pm b/lib/Catalyst/Controller/FormBuilder/Action.pm
index be476b7..29fad7a 100644
--- a/lib/Catalyst/Controller/FormBuilder/Action.pm
+++ b/lib/Catalyst/Controller/FormBuilder/Action.pm
@@ -133,6 +133,7 @@ sub execute {

     my $form = $self->_setup_form(@_);
     Scalar::Util::weaken($form->{c});
+    Scalar::Util::weaken($form->{params});
     $controller->_formbuilder($form);
     $self->maybe::next::method(@_);
     $controller->_formbuilder($form);   # keep the same form in case of forwards

#794598#14
Date:
2015-08-04 22:42:14 UTC
From:
To:
Thanks for your bug report, I've forwarded it to the upstream bug
tracker:
https://rt.cpan.org/Ticket/Display.html?id=106251


Cheers,
gregor