Libc6 malloc bites?

jeremy at itassist.net.au jeremy at itassist.net.au
Sat Sep 1 14:18:06 EST 2001


On  1 Sep, Tomasz Ciolek wrote:
>  Perl has its own malloc. Is it possible someone complied the package using perlmalloc and not the Linux malloc?
> 
>  I'm not having any problems with perl proggs (wunning current woody)

I didn't know that Perl has it's own malloc, but I'm sure that it's the
libc6 one because a gdb backtrace claims that the last call before the
segfault was to the libc6 malloc (previous email).  Unless it's falling
over while returning... possible I guess.

I'm not having any problem with other perl progs, just this one.

I've posted to PerlMonks and so far noone has said "you're doing a
terribly bad thing" so I'll keep chipping away at it.
FWIW, here's the offending code.  Sometimes it's the split, sometimes it's the 
foreach and sometimes it's the eval that goes.  If I limit $word to be
under 5 letters it works fine.

sub highlight_block {
	my ($block, $sep, $word)=@_;

		#print "Before $word, $sep\n";
		my @let = split //, $word;
		my @rep;
		my $i=1;

		 foreach my $l (@let) {$l = "(".$l.")(.{$sep})";push  @rep, '\u$'.$i++.'$'.$i++;};
		my $rep = join "", @rep;

		my $regexp2 = join "", @let;
		my $ev = '$block =~ '."s/$regexp2/$rep/i;";

		my $res = eval $ev;
		print $res;$block = $res;
		print $block, "\n\n";
		#print "after\n";
		return $block;
}

-- 
I/O, I/O,
It's off to disk I go,
A bit or byte to read or write,
I/O, I/O, I/O...






More information about the linux mailing list