Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Segfault on second (identical) call to a sub

by zentara (Archbishop)
on Feb 04, 2006 at 20:36 UTC ( [id://527990]=note: print w/replies, xml ) Need Help??


in reply to Segfault on second (identical) call to a sub

I have linux, I get
Perl:5.008007; 2.30Waiting *** glibc detected *** free(): invalid pointer: 0x08281410 ***

Curiously, if I put the second call in a separate sub, it runs error free.

#!/usr/bin/perl use warnings; use strict; use GD; print "Perl:$]; $GD::VERSION"; my $cap = x( 100, 100 ); printf 'Waiting'; <STDIN>; $cap = zz( 100, 100 ); ################################################# sub x{ my( $x, $y ) = @_; GD::Image->trueColor( 1 ); my $gd = GD::Image->new( $x, $y ); my $raw = $gd->gd; my $img = GD::Image->newFromGdData( $raw ) or die "$!, $^E"; return $img->jpeg; } sub zz{ my( $x, $y ) = @_; GD::Image->trueColor( 1 ); my $gd = GD::Image->new( $x, $y ); my $raw = $gd->gd; my $img = GD::Image->newFromGdData( $raw ) or die "$!, $^E"; return $img->jpeg; }

I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://527990]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found