geektron has asked for the wisdom of the Perl Monks concerning the following question:

i'm at a loss for debugging this error:

Bad free() ignored at /usr/SD/perl5.004_05/lib/site_perl/SNMP.pm line +296, <GEN19> chunk 45.

sure, i have a line number to start with, but i have no clue where to go from there. what are the 'chunks' and the <GEN#>s all about? the chunk and gen numbers change, and i know that the errors are occurring when a forked process exits, but what next?

Replies are listed 'Best First'.
Re: digging errors out of C/XS code.
by chipmunk (Parson) on Dec 05, 2000 at 04:32 UTC
    <GEN19> chunk 45 means that when the error occured, GEN19 was the last filehandle read from, and it has been read from 45 times. (Originally, that part of the error message said 'line 45', but that wasn't accurate when the input record separator had a value other than "\n".) That's just info added by Perl to help in tracking down errors -- it's not always useful though.

    Here's the description of Bad free() ignored from perldiag:

    Bad free() ignored (S) An internal routine called free() on something that had never been malloc()ed in the first place. Mandatory, but can be disabled by setting environment variable PERL_BADFREE to 1. This message can be quite often seen with DB_File on systems with "hard" dynamic linking, like AIX and OS/2. It is a bug of Berkeley DB which is left unnoticed if DB uses forgiving system malloc().
    I hope that helps!