PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: Memory leak
Date: Apr 20 1998 7:24PM

Rick Smith writes:
 > 
 > would this affect us if we're using code like below ?
 > 
 > 
 > $acct = Sybase::CTlib->ct_connect($uid, $pwd, $srv);
 > $acct->ct_execute("select * from dunning");
 > while(($rc = $acct->ct_results($restype)) == CS_SUCCEED)
 > { next if ($restype == CS_CMD_DONE || $restype == CS_CMD_FAIL ||
 >   $restype == CS_CMD_SUCCEED);
 >   while (@data = $acct->ct_fetch)
 >   {

No.

I tested the following on a 150000 row table and had a stable memory
usage:

$sql = "select * from excalibur..transactions";
$dbh->ct_execute($sql);
while($dbh->ct_results($restype) == CS_SUCCEED) {
    next unless ($dbh->ct_fetchable($restype));

    while(@dat = $dbh->ct_fetch) {
	print "@dat\n";
    }
}

Michael


 > .
 > .
 > .
 > 
 > 
 > On Mon, 20 Apr 1998, Michael Peppler wrote:
 > 
 > > Shaun McClimon writes:
 > >  > Can someone help me with my code?  This code continues to use memory up
 > >  > and has gotten as high as 40 megs.  What is going on? 
 > >  > 
 > >  >         $ref = $T->ct_sql($IDS);
 > >  >         $del = $T->ct_sql("delete ids1db..tESC where counter =
 > >  > @dat[25]");
 > > 
 > > ct_sql() leaks, unfortunately.
 > > 
 > > I have not had the time to figure out exactly why it leaks, when a
 > > similar code sequence that is not in a subroutine doesn't leak.
 > > 
 > > You can work around this by not using ct_sql(), and writing your own
 > > ExecSql() routine that does not fetch any rows, for example.
 > > 
 > > Michael
 > > -- 
 > > Michael Peppler         -||-  Data Migrations Inc.
 > > mpeppler@datamig.com    -||-  http://www.mbay.net/~mpeppler
 > > Int. Sybase User Group  -||-  http://www.isug.com
 > > 
 > > 
 > 
 > 

-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@datamig.com    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com