Hi,

I recently upgraded a system (as far as perl is concerned from 5.8.7 to 5.10.0).
Afterwards I ran into a mysterious problem. I could eventually find a 
workaround,
but still don't really understand, what is going on.

After the upgrade, a perl program wouldn't run anymore - it crashed with a 
message:
"*** glibc detected *** /usr/bin/perl: double free or corruption (fasttop): ..."
and a memory map suggesting some problem on the heap.
The crash can be reproduced by the following code:


use Net::LDAP;
my $self=Net::LDAP->new("127.0.0.1");
($self->{prog_name}= $0) =~ s|^.*/([^/]+)$|$1|;

# when I put an intermediate variable into the statement:

$self->{prog_name}= (my $_p= $0) =~ s|^.*/([^/]+)$|$1|;

the program works again.

Technically, my problem is solved, but maybe somebody here can shed some light 
on
some questions:

- Where does glib come into play? Is it generally used by perl?

- I tried to run the program under the debugger hoping to find, where exactly 
the
  error occurs - unfortunately the same program suddenly worked just fine, so I
  ended up putting print statements into the code until I eventually found the
  problematic line. Why can't the crash be reproduced under the debugger?
  Would there be an easier way to find the problem?

- Generally, I still don't understand what's wrong with the original program 
code.
  I didn't try it but I don't think it is anything specific to Net::LDAP. 
However,
  when $self is just some hash reverence ("my $self={}"), the code also works
  without any problem.

Regards,
                      Peter Daum



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to