"Free to wrong pool" and other errors



A program I am working on generates the following errors:

Attempt to free unreferenced scalar: SV 0x1f875cc, Perl interpreter:
0x22440c at C:/Perl/site/lib/DBD/ODBC.pm line 381.
Attempt to free unreferenced scalar: SV 0x1f87860, Perl interpreter:
0x22440c at C:/Perl/site/lib/SQL/Translator/Parser/DBI/SQLServer.pm
line 232.
Free to wrong pool 222828 not ff at
C:/Perl/site/lib/SQL/Translator/Parser/DBI.pm line 184.

The first "Attempt to free..." error has been occurring for a while,
but didn't seem to actually hinder operation so I ignored it. The other
errors appear to be resulting from new code I recently added. The line
232 referenced is simply:

getConstraints($table, $dbh);

A call to a new function I just added. That function is:

sub getConstraints {
my ($obj, $dbh) = @_;
my $table_name = $obj->name;
my $h = $dbh->selectall_arrayref("sp_helpconstraint $table_name,
nomsg", {Slice => {}});

my @rows = @{$h};
while (my $row = shift @rows ) {
#print STDERR "Constraint: got row: ", Dumper($row);
my $constraint = $obj->add_constraint( name =>
$row->{CONSTRAINT_NAME},
fields => [split(/, /, $row->{CONSTRAINT_KEYS})],
) or die "Couldn't add constraint $row->{CONSTRAINT_NAME}.";
if ($row->{CONSTRAINT_TYPE} =~ /\((.+)\)/) {
if ($1 eq "clustered") {
$constraint->extra(mssql_clustered => 1);
}
}
if ($row->{CONSTRAINT_TYPE} eq "FOREIGN KEY") {
$constraint->on_delete($row->{delete_action});
$constraint->on_update($row->{update_action});
my $nextrow = shift @rows;
if ($nextrow->{CONSTRAINT_KEYS} =~ /^REFERENCES (.+) \((.+)\)$/)
{
$constraint->type("FOREIGN_KEY");
$constraint->reference_fields(split(/, /, $2));
my @ref = split(/\./, $1);
$constraint->reference_table(join(".", map {"[$_]"} @ref[1..2]));
$constraint->extra("mssql_references_table_owner" => $ref[1]);
$constraint->extra("mssql_references_table_db" => $ref[0]);
}
} elsif ($row->{CONSTRAINT_TYPE} =~ /^PRIMARY KEY/) {
$constraint->type("PRIMARY_KEY");
} elsif ($row->{CONSTRAINT_TYPE} =~ /^UNIQUE/) {
$constraint->type("UNIQUE");
} else {
die "Unknown constraint type! " . Dumper($row);
}
}
}

This seems to be the part giving me all the problems. The "Free to
wrong pool..." error only comes up when I use the selectall_arrayref()
function, but that hasn't been the only problem. The function was
originally written with a statement handle and multiple calls to
fetchrow_hashref, but instead of getting hashrefs back I was getting
UNKNOWN refs, whatever those are. With this function call commented
out, there are multiple calls to selectall_hashref on the same dbh that
work fine.

I've read that you can get the "Free to wrong pool..." error when using
threads, but I'm not using threads. I am using ActivePerl 5.8.6.811,
DBI 1.48, and DBD-ODBC 1.11. If it matters, the dbh is an ODBC
connection to a SQL Server database.

Any suggestions on what I can do here?

Chris Hilton

.



Relevant Pages

  • Re: Help - Inline::C arrayref deref?
    ... "Attempt to free unreferenced scalar: ... print "Running 10 iterations of foo1\n"; ... The foo3 function leaks memory, but at least demonstrates that the ... Attempt to free unreferenced scalar: SV 0x3f5d78, Perl interpreter: 0x3f416c ...
    (comp.lang.perl.misc)
  • Re: Attempt to free unreferenced scalar
    ... > Attempt to free unreferenced scalar: SV 0x38bd0a4, Perl interpreter: ... The only time I've seen errors like that is in threading code that ... Prev by Date: ...
    (perl.beginners)
  • Attempt to free unreferenced scalar
    ... Attempt to free unreferenced scalar: SV 0x38bd0a4, Perl interpreter: ... Teddy ... Prev by Date: ...
    (perl.beginners)