On Mon, 2002-03-18 at 14:21, John W. Krahn wrote:
> Chas Owens wrote:
> > 
> > I am receiving a strange error on exiting a script: Attempt to free
> > unreferenced scalar during global destruction.  It only occurs after I
> > make a DBI connection and run an SQL statement.  I am undefing the
> > statement handle and disconnecting the database handle.  Does anyone
> > have a clue what this might be?
> 
> perldoc perldiag
> [snip]
> Attempt to free unreferenced scalar
>     (W internal) Perl went to decrement the reference
>     count of a scalar to see if it would go to 0, and dis­
>     covered that it had already gone to 0 earlier, and
>     should have been freed, and in fact, probably was
>     freed.  This could indicate that SvREFCNT_dec() was
>     called too many times, or that SvREFCNT_inc() was
>     called too few times, or that the SV was mortalized
>     when it shouldn't have been, or that memory has been
>     corrupted.
> 
> 
> Are you doing "undef $scalar" in your code?  If so, don't.  You should
> _never_ have to use undef in this manner.  Use my() to create a lexical
> scope and let perl take care it.
> 
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment

I grepped the source code for undef and only got back these lines.

app.pm:         $sth = undef;
app.pm: $sth = undef;
app.pm: local($/) = undef;
app.pm: return undef;
app.pm: return undef;
app.pm: return undef;
app.pm:         $row = undef;
app.pm: return undef;

It doesn't look like I am undefing a variable, only assigning undef to
them (to free the cursor in two cases, to indicate no error in four
cases, and to remove the contents of the variable in one case); however,
there are some cases where I say things like:

Gnome::MessageBox->new(
        'A query is already running',
        'warning',
        'close'
)->show_all;

without catching the the object created by Gnome::MessageBox->new. 
Could these be the culprit?


-- 
Today is Boomtime the 4th day of Discord in the YOLD 3168
Or is it?

Missile Address: 33:48:3.521N  84:23:34.786W


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to