Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: memory problems
Date: May 3 2002 2:36PM

On Fri, 2002-05-03 at 06:16, wrote:
> Hi, 
> I have a sybperl (ver 2.06) script that chews up gobs of memory 
> on my Solaris system.  I am retrieving  text fields from sybase.
> I read each result into a hash and process it.  my script will
> reach 250+ MB plus before it runs out of memory.  this was
> exacerbated when I had to bump up the textsize on the query
> to 2048000.  I have tried to reinitialize the hash ( %hash = ""; ) 
> after each fetch but it doesn't help.

John Gilmore-Baldwin's comments are on the money:

You empty a hash by doing:

%hash = ();

Reconnecting to Sybase won't help. Sybperl itself *shouldn't* be leaking
(although 2.06 is pretty old, so it's not impossible that it has some
problems in that respect).

(as an aside, you disconnect from Sybase in a sybperl script either by
calling $dbh->dbclose() [Sybase::DBlib] or by having the handle go out
of scope/become undefined: $dbh = undef;)

Is there any way for you to post a section of the script that
illustrates the problem? There might be some issue with variables
getting set but never getting freed due to the way they are used.

Also I'm guessing that you have a fairly old version of perl, and that
may also contribute to the problem.

Michael Peppler                              Data Migrations, Inc.           *or*
International Sybase User Group: