in reply to digging errors out of C/XS code.

<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!