I've written a big Perl script that reads from & writes to a SQL Server database. It
seems to work just fine, except that it sometimes gives a mysterious memory access
violation when it exits:
"Perl.exe - Application Error: The instruction at 0x411744a3 referenced memory at
0x411744a3. The memory could not be read".
In trying to debug this, I've reduced my original script to a tiny skeleton
(abstracted below) that still evinces the same problem:
use strict;
use Time::Local;
use Getopt::Std;
use DBI;
my $dsn = "DBI:ODBC:Name";
my $dbh1 = DBI->connect ($dsn, "user", "password", {PrintError=>0, RaiseError=>1,
AutoCommit=>1});
my $dbh2 = DBI->connect ($dsn, "user", "password", {PrintError=>0, RaiseError=>1,
AutoCommit=>1});
my $sth1 = $dbh1->prepare ("SELECT * FROM tablename");
$dbh1->disconnect();
$dbh2->disconnect();
exit 0;
However, the access violation only occurs when this skeleton is followed by 40K of
other code (leftover from the original program) that's never executed.
This sensitivity to memory alignment suggests a subtle bug in DBI that's corrupting a
data structure that tracks resources to be freed at DB disconnect time.
Is this a known bug? Does it affect only the exit (as I suspect), or might the body
of my program be affected as well? Is there a fix?
I'm running this under ActivePerl 5.6.1 on Windows 2000.
DOS> perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
Thanks for any help.
Joe Tebelskis | Sr. Software Engineer
InfoSpace INC 601 108th Ave NE | Suite 1200 | Bellevue, WA 98004
Tel 425.201.8765 | Fax 425.201.6159 | Mobile 425.417.5801
[EMAIL PROTECTED] | www.infospaceinc.com
Discover what you can do.TM