I've almost finished libpcp_import and the Perl wrapper, but one issue
has me stumped.
My test program in C works fine (as in run under the control of valgrind
without errors).
The functionally identical Perl program dies when perl_destruct() is
called as perl finishes and aborts on a bad call to free(). The
valgrind version of the failure is
==13144== Invalid free() / delete / delete[]
==13144== at 0x4024B3A: free (vg_replace_malloc.c:366)
==13144== by 0x807E16F: perl_destruct (in /usr/bin/perl)
==13144== by 0x8064324: main (in /usr/bin/perl)
==13144== Address 0x47a76e0 is 0 bytes inside data symbol "tzbuffer.6702"
Now the only tzbuffer we have is a static (!) array inside libpcp
(tzbuffer is in __pmTimezone()) and as far as I can tell the address of
this buffer does not escape out into the view of the perl.
I've reduced this to the following simple Perl program that shows the problem
...
#!/usr/bin/perl
use strict;
use warnings;
use PCP::LogImport;
$_ = pmiStart("myarchive", 0);
$_ = pmiAddMetric("mymetric", -1, 0, -1, 3, 0);
$_ = pmiPutValue("mymetric", "", 123456);
$_ = pmiWrite(-1, -1);
The LogImport.pm and LogImport.xs code is simple and does not involve
any OO abstractions ... it is simply a wrapper around calls to the
libpcp_import routines.
Does anyone on the list know enough about the guts of Perl to help me
understand how to get control over, or debug, what perl_destruct() is
trying to do?
|