Re: Memory Leak Problems using DBD::Informix
Posted in 1998
Dean Smith wrote: > This problem is apparent in with DBD::Informix 0.6 on DBI::0.93 and > DBI::1.02 and also on DBD::Informix 0.59 on DBI::0.93. It may be > present in other version, but I have yet to test. It does not occur > with other DBD libraries. Ie. postgresql. > > Informix Online Server 7.30.UC3 > ESQLC 7.24.UC5 > Solaris 2.6 > Perl 5.004_4 > > The problem is basically thus > > Queries run as follows > > $qh = $dbh->prepare("select foo from bar where foobar=?"; > $qh->execute(7); > > leak memory. The leak isn't directly proportional to the size of the > paramater, but does increase with paramater size ( ie. a blob causes > more of a leak than an integer ) > > However queries run as follows > > $qh=$dbh->prepare("select foo from bar where foobar=7"; > $qh->execute(); > > do no leak at all. This problem only came to light when code was being > used in a daemon, and at first our code was suspected. However tests > conducted with a simple one table database and the simpliest DBI code > reproduce the leak. > > Does anyone have any ideas what could be causing this and ideas for > soloutions. Well, it would appear that DBD::Informix is somehow misusing parameters it is passed in the execute operation - presumably by incrementing the reference count somehow when that isn't what's really wanted. Since it isn't a problem with other drivers, it is presumably a problem with the way DBD::Informix is doing it rather than DBI. At this stage, I don't have any good ideas what the cause is, much less what the fix is. The obvious trick is to evade it -- use the fully written out statement. You've no need to tell me that is less efficient -- I don't like it either, but it is all I can offer immediately. Fixing this is like to be a real painful process. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>