Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Segmentation fault

by nite_man (Deacon)
on Apr 03, 2003 at 14:48 UTC ( #247774=perlquestion: print w/replies, xml ) Need Help??
nite_man has asked for the wisdom of the Perl Monks concerning the following question:

Hi brothers,
Who can tell me when is segmentaion fault error in the perl script?
My environment following:
  • Linux Red Hat 8.0;
  • Perl v5.8.0 built for i386-linux-thread-multi.
--------> SV* sv_bless(SV* sv, HV* stash);

Replies are listed 'Best First'.
Re: Segmentation fault
by Improv (Pilgrim) on Apr 03, 2003 at 14:52 UTC
    There are some things that can be the fault of the hardware (bad memory or faulty CPU), some that can be the fault of the package (are you using redhat's Perl, or did you build your own?), some that might be because of you using less reliable features of Perl (signal handling can be iffy, as threads once were), and some might be legitimate bugs in perl (although these are pretty rare). Can you give us more information on what your script is trying to do, when it crashes, and what you're running it on?
      I use Perl from Red Hat package.
      The script developed with Tk. Generally, script works correctly. This error shows only when I exit from my application.
      This code for exit button:
      Button(-text=> "Exit", -command=> sub { Quiting::quiting(); }, ) ->pack(-side=> 'bottom', -fill => 'x', -expand => 1 );
      package Quiting; sub quiting { # Delete a temporary file system ('rm /tmp/mytmp.txt') if (-e '/tmp/mytmp.txt'); exit(0); }
      --------> SV* sv_bless(SV* sv, HV* stash);
Re: Segmentation fault
by converter (Priest) on Apr 03, 2003 at 22:56 UTC

    Unless you're importing Tk in your Quiting package, you're calling CORE::exit. Try calling Tk::exit instead.

    If that doesn't work, you can always invoke the MainWindow Toplevel's destroy method and place your cleanup code after the call to MainLoop.

Re: Segmentation fault
by nite_man (Deacon) on Apr 03, 2003 at 15:59 UTC
    I tried to trace my application by strace -f and I found that error 'Segmentation fault' shows after calling gettimeofday() function.
    I found too, that this function consists only into the binary file (which belong to Tk package) from dir auto.
    Maybe this error is bag of Tk::Event?
    --------> SV* sv_bless(SV* sv, HV* stash);
      It is probably a bug in the shared library. In my experience, segmentation faults with Perl are almost always caused by C extension libraries.

      One thing to check is the versions of the binary modules and the supporting libraries they use. What version of Perl/Tk are you using? Did you build the Tk module yourself or install a packaged distribution? Version mismatches between the module and the support library, and between Perl and the mdoule, always cause problems.

        I use latest varsion Perl/Tk - Tk-800.024 and I installed it from CPAN archive. I'm agree with you maybe this error caused not correct C library.
        Ok, many thanks, I will try to resolve this trouble!
        --------> SV* sv_bless(SV* sv, HV* stash);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://247774]
Approved by particle
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2018-05-24 10:34 GMT
Find Nodes?
    Voting Booth?