Skip Menu |

This queue is for tickets about the MooseX-Traits CPAN distribution.

Report information
The Basics
Id: 52529
Status: resolved
Priority: 0/
Queue: MooseX-Traits

People
Owner: Nobody in particular
Requestors: harv [...] ruin.nu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.07
Fixed in: (no value)



Subject: Memory leak (cycle) with meta method getting $meta from closure.
In MooseX::Traits::Util::new_class_with_traits() an anonymous class, $meta, is created. A meta method is added, which returns $meta from closure, resulting in a cycle. Making $meta a weak ref with Scalar::Util::weaken() seems to fix it. Cycle (1): $Class::MOP::Class::Immutable::Moose::Meta::Class::A-> {'methods'} => \%B $B->{'execute'} => \ %MooseX::Method::Signatures::Meta::Method::C $MooseX::Method::Signatures::Meta::Method::C-> {'parsed_signature'} => \%Parse::Method::Signatures::Sig::D $Parse::Method::Signatures::Sig::D->{'_positional_params'} => \ %Parse::Method::Signatures::ParamCollection::E $Parse::Method::Signatures::ParamCollection::E->{'params'} => \@F $F->[0] => \ %Class::MOP::Class::__ANON__::SERIAL::5::G $Class::MOP::Class::__ANON__::SERIAL::5::G->{'__MOP__'} => \ %Moose::Meta::Class::H $Moose::Meta::Class::H->{'methods'} => \ %I $I->{'meta'} => \&J $J variable $meta => \$K $$K => \%Moose::Meta::Class::H
It's not a leak, but i see how the cycle makes checking your actual code against actual memory leaks unnecessarily hard. 0.10 removes it.