summaryrefslogtreecommitdiff
path: root/Bugs/substleak
diff options
context:
space:
mode:
Diffstat (limited to 'Bugs/substleak')
-rw-r--r--Bugs/substleak98
1 files changed, 98 insertions, 0 deletions
diff --git a/Bugs/substleak b/Bugs/substleak
new file mode 100644
index 0000000000..ff14446488
--- /dev/null
+++ b/Bugs/substleak
@@ -0,0 +1,98 @@
+Return-Path: Martin.Ward@durham.ac.uk
+Return-Path: <Martin.Ward@durham.ac.uk>
+Received: from scalpel.netlabs.com by netlabs.com (4.1/SMI-4.1)
+ id AA01931; Thu, 20 Jan 94 03:56:39 PST
+Received: from netlabs.com (vaccine-eng1.netlabs.com) by scalpel.netlabs.com (4.1/SMI-4.1)
+ id AA09639; Thu, 20 Jan 94 03:56:36 PST
+Received: from sun2.nsfnet-relay.ac.uk by netlabs.com (4.1/SMI-4.1)
+ id AA01923; Thu, 20 Jan 94 03:56:01 PST
+Via: uk.ac.durham; Thu, 20 Jan 1994 11:47:16 +0000
+Received: from easby.dur.ac.uk by durham.ac.uk; Thu, 20 Jan 94 11:47:05 GMT
+Received: from ws-csm3.durham.ac.uk (ws-csm3.dur) by uk.ac.durham.easby;
+ Thu, 20 Jan 94 11:46:29 GMT
+From: Martin.Ward@durham.ac.uk (Martin Ward)
+Date: Thu, 20 Jan 94 11:46:27 GMT
+Message-Id: <AA00871.9401201146.ws-csm3@uk.ac.durham>
+To: des0mpw@easby.durham.ac.uk, lwall@scalpel.netlabs.com
+Subject: Re: My last message
+
+>: After saying I was stumped, I managed to track down the problem!
+>: The problem was caused by a line much higher up:
+>:
+>: $seqpat = "$bs[s]\000e\000q\000\{\000"; # } hack
+>:
+>: Changing this by adding {} gives:
+>:
+>: $seqpat = "${bs}[s]\000e\000q\000\{\000"; # } hack
+>:
+>: which worked! No idea why :-)
+>
+>It apparently intuited $bs[s] to be an array reference.
+
+Aha! I think the interpretation is:
+"$bs[ s] .....
+^^^^^ ^^
+array ref Therefore this is an expression, so "s]" is the start of
+ a pattern match/replace, so it scans for ...]....]
+
+I found the line by repeatedly chopping away everything after (and including)
+the line where perl _thought_ the error started. This gradually worked back
+through a nasty cascade of errors!
+
+>: No speed improvement this time (the improvement in user time was swamped
+>: by an increase in system time. This may be because it uses 5048k of
+>: data/stack space, compared with 985k for perl4).
+>
+>That doesn't sound good. I hope it's a bug. Does it grow continuously?
+>Hopefully it's just a memory leak.
+
+For perl4 the memory size (shown by top) grows by about 100-150k per 2 seconds,
+for perl5 it grows by about 1 - 1.5 Meg per 2 seconds. I don't use the script
+very often (and I have over 100 Meg of swap space) so its not a big problem.
+Still, with a 124k input file, the size for perl5 went up to 40 Meg!
+
+I have tracked down a memory leak, which is basically one line from the
+texqed script. Store this script in "tmp" and run "perl tmp /vmunix"
+(or some other large random file). Monitor the process using "top" in
+another window.
+
+Perl4 is OK but perl5 leaks like a leaky cistern.
+
+
+#!/usr/local/bin/perl
+
+# print a "." every $interval lines:
+$interval = 10;
+open (PAIRS, "$ARGV[0]");
+open (OUT, "> /dev/null");
+$bs = "\\\\" . "\000";
+for (;;) {
+ $line++;
+ if (($line % $interval) == 0) {
+ print STDERR ".";
+ }
+ read(PAIRS, $_, 20);
+ last if ($_ eq "");
+
+ s/$bs([_^\\])\000/\\\377$1\377/g;
+
+ print OUT ;
+}
+
+print STDERR "\n";
+
+
+
+I hope you find this useful!
+
+NB Changing the "s/.../.../g" to an "m/.../" (with the same pattern)
+makes the leak go away even on input files where the pattern NEVER matches!!
+
+ Martin.
+
+JANET: Martin.Ward@uk.ac.durham Internet (eg US): Martin.Ward@durham.ac.uk
+or if that fails: Martin.Ward%uk.ac.durham@nsfnet-relay.ac.uk
+or even: Martin.Ward%DURHAM.AC.UK@CUNYVM.CUNY.EDU
+BITNET: Martin.Ward%durham.ac.uk@UKACRL UUCP:...!uknet!durham!Martin.Ward
+[Last acked 0.7 days ago--not acked]
+