Subject: | Memory leak (cycle) Moose::Meta::Method::Accessor and Moose::Meta::Method::Constructor through $meta from environment |
Both have '$meta' set to \$self in their environments for
_compile_code, which then seems to add this variable to the closure of
generated code, resulting in a cycle. This is done in:
Moose::Meta::Method::Constructor::__initialize_body()
Moose::Meta::Method::Accessor::_eval_code()
Not sure how to weaken those references though.
Cycle (1):
$Class::MOP::Class::Immutable::Moose::Meta::Class::A->
{'__immutable'} => \%B
$B->{'inlined_methods'} => \@C
$C->[0] => \
%Moose::Meta::Method::Constructor::D
$Moose::Meta::Method::Constructor::D->{'body'} =>
\&E
$E variable $meta => \$F
$$F => \
%Moose::Meta::Method::Constructor::D
-----------------------------------------------------------
Cycle (1):
$Class::MOP::Class::Immutable::Moose::Meta::Class::A->
{'__immutable'} => \%B
$B->{'inlined_methods'} => \@C
$C->[0] => \
%Moose::Meta::Method::Constructor::D
$Moose::Meta::Method::Constructor::D->{'attributes'} =>
\@E
$E->[0] => \%Moose::Meta::Attribute::F
$Moose::Meta::Attribute::F->{'associated_methods'} =>
\@G
$G->[0] => \
%Moose::Meta::Method::Accessor::H
$Moose::Meta::Method::Accessor::H->{'body'} =>
\&I
$I variable $meta => \$J
$$J => \
%Moose::Meta::Method::Accessor::H