arielf@taux01.nsc.com (Ariel Faigon) (12/06/90)
The following program should actually print-out its input.
Instead it outputs (note the 'cde:' garbage on the second line):
: 0; abcde
: cde:345678923456789ABCDEFGHIJKLMNOPQRSTUVWXYZfghijklmnopqrstuvwxyz
end of example
Looks like some kind of memory-leak to me.
#!/usr/local/bin/perl
while (<DATA>) {
print $_;
while (/(: \d+; )/) {s/$1//;}
s/abcde//;
}
__END__
: 0; abcde
: 1; 2345678923456789ABCDEFGHIJKLMNOPQRSTUVWXYZfghijklmnopqrstuvwxyz
end of example
--
Ariel Faigon, CTP group, NSTA
National Semiconductor (Israel)
6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel Tel. (972)52-522312
arielf@taux01.nsc.com @{hplabs,pyramid,sun,decwrl} 34 48 E / 32 10 N
vinoski@apollo.HP.COM (Stephen Vinoski) (12/07/90)
In article <5052@taux01.nsc.com> arielf@taux01.nsc.com (Ariel Faigon) writes: >The following program should actually print-out its input. >Instead it outputs (note the 'cde:' garbage on the second line): >: 0; abcde >: cde:345678923456789ABCDEFGHIJKLMNOPQRSTUVWXYZfghijklmnopqrstuvwxyz >end of example > >Looks like some kind of memory-leak to me. > >#!/usr/local/bin/perl >while (<DATA>) { > print $_; > while (/(: \d+; )/) {s/$1//;} > s/abcde//; >} >__END__ >: 0; abcde >: 1; 2345678923456789ABCDEFGHIJKLMNOPQRSTUVWXYZfghijklmnopqrstuvwxyz >end of example My fixed version of perl pl41 does the right thing with this. The same bug probably caused the corruption Randal reported a few articles back, too. Larry has been notified of the bug causing this; meanwhile, here is an unofficial patch for the problem: *** str.c.old Fri Nov 16 20:23:48 1990 --- str.c Sat Nov 17 12:32:11 1990 *************** *** 804,809 **** --- 804,810 ---- if (get_paragraph && oldbp) obpx = oldbp - str->str_ptr; bpx = bp - str->str_ptr; /* prepare for possible relocation */ + str->str_cur = bpx; STR_GROW(str, str->str_len + append + cnt + 2); bp = str->str_ptr + bpx; /* reconstitute our pointer */ if (get_paragraph && oldbp) -steve -- | Steve Vinoski (508)256-6600 x5904 | Internet: vinoski@apollo.hp.com | | Testability and Diagnostics | UUCP: ...mit-eddie!apollo!vinoski| | HP Apollo Division, Chelmsford, MA 01824 | ...uw-beaver!apollo!vinoski|