1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

pass a file name to memanalyze to read from instead of using stdin

This commit is contained in:
Daniel Stenberg 2003-01-09 11:26:57 +00:00
parent abb01123cb
commit ba25cad6e2
2 changed files with 20 additions and 4 deletions

View File

@ -6,14 +6,17 @@
# MEM mprintf.c:1103 realloc(e5718, 64) = e6118 # MEM mprintf.c:1103 realloc(e5718, 64) = e6118
# MEM sendf.c:232 free(f6520) # MEM sendf.c:232 free(f6520)
do { while(1) {
if($ARGV[0] eq "-v") { if($ARGV[0] eq "-v") {
$verbose=1; $verbose=1;
shift @ARGV;
} }
elsif($ARGV[0] eq "-t") { elsif($ARGV[0] eq "-t") {
$trace=1; $trace=1;
shift @ARGV;
} }
} while (shift @ARGV); last;
}
my $maxmem; my $maxmem;
@ -26,7 +29,19 @@ sub newtotal {
} }
} }
while(<STDIN>) { my $file = $ARGV[0];
if(! -f $file) {
print "Usage: memanalyze.pl [options] <dump file>\n",
"Options:\n",
" -v Verbose\n",
" -t Trace\n";
exit;
}
open(FILE, "<$file");
while(<FILE>) {
chomp $_; chomp $_;
$line = $_; $line = $_;
@ -219,6 +234,7 @@ while(<STDIN>) {
print "Not recognized prefix line: $line\n"; print "Not recognized prefix line: $line\n";
} }
} }
close(FILE);
if($totalmem) { if($totalmem) {
print "Leak detected: memory still allocated: $totalmem bytes\n"; print "Leak detected: memory still allocated: $totalmem bytes\n";

View File

@ -777,7 +777,7 @@ sub singletest {
print "\n** ALERT! memory debuggin without any output file?\n"; print "\n** ALERT! memory debuggin without any output file?\n";
} }
else { else {
my @memdata=`$memanalyze < $memdump`; my @memdata=`$memanalyze $memdump`;
my $leak=0; my $leak=0;
for(@memdata) { for(@memdata) {
if($_ ne "") { if($_ ne "") {