X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F52leaks.t;h=b395483dcf34c1e644d1119c55c49132d725fa9c;hb=8aae794001ecccdb26c2bbd1b92c97bba9e65d79;hp=ae96a217650fa91cef2f920a67f885daf8230259;hpb=296248c321e75da7fd912ed80b8644aa3cdcccd6;p=dbsrgits%2FDBIx-Class.git diff --git a/t/52leaks.t b/t/52leaks.t index ae96a21..b395483 100644 --- a/t/52leaks.t +++ b/t/52leaks.t @@ -90,15 +90,26 @@ if ( !$ENV{DBICTEST_VIA_REPLICATED} and !DBICTest::RunMode->is_plain ) { return populate_weakregistry ($weak_registry, $obj ); }; - require Try::Tiny; - for my $func (qw/try catch finally/) { - my $orig = \&{"Try::Tiny::$func"}; - *{"Try::Tiny::$func"} = sub (&;@) { + + for my $func (qw( dbic_internal_try dbic_internal_catch )) { + my $orig = \&{"DBIx::Class::_Util::$func"}; + *{"DBIx::Class::_Util"} = sub (&;@) { populate_weakregistry( $weak_registry, $_[0] ); goto $orig; } } + if ( eval { require Try::Tiny } ) { + for my $func (qw( try catch finally )) { + my $orig = \&{"Try::Tiny::$func"}; + *{"Try::Tiny::$func"} = sub (&;@) { + populate_weakregistry( $weak_registry, $_[0] ); + goto $orig; + } + } + } + + # Some modules are known to install singletons on-load # Load them and empty the registry @@ -461,6 +472,15 @@ for my $addr (keys %$weak_registry) { delete $weak_registry->{$addr} unless $cleared->{bheos_pptiehinthashfieldhash}++; } + elsif ( + $names =~ /^Data::Dumper/m + and + $weak_registry->{$addr}{stacktrace} =~ /\bDBIx::Class::SQLMaker::Util::lax_serialize\b/ + ) { + # only clear one object of a specific behavior - more would indicate trouble + delete $weak_registry->{$addr} + unless $cleared->{dd_lax_serializer}++; + } elsif ($names =~ /^DateTime::TimeZone::UTC/m) { # DT is going through a refactor it seems - let it leak zones for now delete $weak_registry->{$addr};