Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Segmentation fault

by nite_man (Deacon)
on Apr 03, 2003 at 14:48 UTC ( [id://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.
TIA.
--------> 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 );
      and
      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 Event.so (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 Event.so 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?
Username:
Password:

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

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

    No recent polls found