summaryrefslogtreecommitdiff
path: root/memanalyze.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-12-14 15:56:59 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-12-14 15:56:59 +0000
commitbf43b49a200dace98a5245e782e0831313461b31 (patch)
tree53513978e4fc93377a2c0a06503c43effa0a3780 /memanalyze.pl
parent6ad9bd80226dd1468a949b26af265d60f29ac910 (diff)
downloadcurl-bf43b49a200dace98a5245e782e0831313461b31.tar.gz
added socket() / sclose() checks to the memdebug system
Diffstat (limited to 'memanalyze.pl')
-rwxr-xr-xmemanalyze.pl29
1 files changed, 29 insertions, 0 deletions
diff --git a/memanalyze.pl b/memanalyze.pl
index 3b706af72..48fff8f27 100755
--- a/memanalyze.pl
+++ b/memanalyze.pl
@@ -72,6 +72,28 @@ while(<STDIN>) {
print "Not recognized input line: $function\n";
}
}
+ # FD url.c:1282 socket() = 5
+ elsif($_ =~ /^FD ([^:]*):(\d*) (.*)/) {
+ # generic match for the filename+linenumber
+ $source = $1;
+ $linenum = $2;
+ $function = $3;
+
+ if($function =~ /socket\(\) = (\d*)/) {
+ $filedes{$1}=1;
+ $getfile{$1}="$source:$linenum";
+ $openfile++;
+ }
+ elsif($function =~ /sclose\((\d*)\)/) {
+ if($filedes{$1} != 1) {
+ print "Close without open: $line\n";
+ }
+ else {
+ $filedes{$1}=0; # closed now
+ $openfile--;
+ }
+ }
+ }
else {
print "Not recognized prefix line: $line\n";
}
@@ -93,3 +115,10 @@ if($totalmem) {
}
}
+if($openfile) {
+ for(keys %filedes) {
+ if($filedes{$_} == 1) {
+ print "Open file descriptor created at ".$getfile{$_}."\n";
+ }
+ }
+}