Memory Allocation Problems using DBD::Informix and Perl
Posted in 1998
Topics: General Discussion
DBD::Informix ver 0.59 DBI:: ver 0.93 Perl version 5.004_04 built for sun4-solaris. The problem: After an initial database handle is created perl returns an out of memory message if more than 11 MB of space is used by the script. ##EXAMPLE SCRIPT 1## #!/usr/local/bin/perl -w $|=1; use DBD::InformixTest; print "start to get db handle\\n"; my $dbh = connect_to_test_database(); print "got db handle $dbh\\n"; # this determines the size of the memory allocation $keys=600000; # we now fill up the hash by pre allocating its key size my $memory={}; print "start to allocated a hash with $keys keys\\n"; keys(%$memory)=$keys; print "allocated a hash with $keys keys\\n"; sleep 10; $dbh->disconnect; exit; ##################################### This fails with:- Out of memory! Database handle destroyed without explicit disconnect. ----------------------------------------------------------- If the allocation is tried before the connect then it is the connect that fails as shown below:- ##EXAMPLE SCRIPT 2## #!/usr/local/bin/perl -w $|=1; use DBD::InformixTest; # this determines the size of the memory allocation $keys=600000; # we now fill up the hash by pre allocating its key size my $memory={}; print "start to allocated a hash with $keys keys\\n"; keys(%$memory)=$keys; print "allocated a hash with $keys keys\\n"; print "start to get db handle\\n"; my $dbh = connect_to_test_database(); print "got db handle $dbh\\n"; sleep 10; $dbh->disconnect; exit; ##################### This fails with:- not ok 1 # Error Message: # SQL: -25588: The appl process cannot connect to Dynamic server test. # ISAM: 4: Interrupted system call # SQLSTATE = IX000 !! Terminating Test !! ----------------------------------------------------------- But if no database connection is attempted then the allocation is successful as shown below:- ##EXAMPLE SCRIPT 3## #!/usr/local/bin/perl -w $|=1; use DBD::InformixTest; # this determines the size of the memory allocation $keys=600000; # we now fill up the hash by pre allocating its key size my $memory={}; print "start to allocated a hash with $keys keys\\n"; keys(%$memory)=$keys; print "allocated a hash with $keys keys\\n"; #print "start to get db handle\\n"; #my $dbh = connect_to_test_database(); #print "got db handle $dbh\\n"; sleep 10; #$dbh->disconnect; exit; ##################### This completes succesfully and returns nothing. It also works with an allocation 10 times bigger (6000000 keys). This allocates 67 MB of memory on our current machine. ----------------------------------------------------------- Has anyone encountered this problem? It seems connect reduces the maximum space that the script containing it can use. Any solutions? Thanks Mark Hewis PA News