This fixes one of the memory leaks.
sub apply {
my ($self, $role, $class) = @_;
+ # We're not checking for role names to support multiple instances of the
+ # same Parameterized role.
+ return if grep { $role == $_ } @{ $class->roles() };
+
# We need weak_ref in CMOP :(
weaken($self->{role} = $role);
weaken($self->{class} = $class);
sub apply {
my ($self, $role1, $role2) = @_;
+
+ # We're not checking for role names to support multiple instances of the
+ # same Parameterized role.
+ return if grep { $role1 == $_ } @{ $role2->get_roles() };
+
$self->SUPER::apply($role1, $role2);
+
$role2->add_role($role1);
}