valgrind doesn't allow more anyway.
Specify the maximum stack depth studied when valgrind encounters an error.
Raising this number improves granularity.
Specify the maximum stack depth studied when valgrind encounters an error.
Raising this number improves granularity.
-Ignored if you supply your own custom C<tool>, otherwise defaults to C<50>.
+Ignored if you supply your own custom C<tool>, otherwise defaults to C<24> (the maximum allowed by C<valgrind>).
my $tool = delete $args{tool};
unless ($tool->$instanceof('Test::Valgrind::Tool')) {
my $tool = delete $args{tool};
unless ($tool->$instanceof('Test::Valgrind::Tool')) {
+ my $callers = delete $args{callers} || 24;
+ $callers = 24 if $callers <= 0;
require Test::Valgrind::Tool;
local $@;
$tool = eval {
Test::Valgrind::Tool->new(
require Test::Valgrind::Tool;
local $@;
$tool = eval {
Test::Valgrind::Tool->new(
- tool => $tool || 'memcheck',
- callers => delete $args{callers},
+ tool => $tool || 'memcheck',
+ callers => $callers,
use base qw<Test::Valgrind::Tool>;
=head1 METHODS
use base qw<Test::Valgrind::Tool>;
=head1 METHODS
- my $callers = delete $args{callers} || 50;
- $callers =~ s/\D//g;
+ my $callers = delete $args{callers};
+ $callers = 24 unless $callers;
+ die 'Invalid number of callers'
+ unless Scalar::Util::looks_like_number($callers) and $callers > 0
+ and $callers <= 24;
my $self = bless $class->Test::Valgrind::Tool::new(%args), $class;
my $self = bless $class->Test::Valgrind::Tool::new(%args), $class;
-sub new_trainer { shift->new(callers => 50) }
+sub new_trainer { shift->new(callers => 24) }