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

Re: segmentation fault - whose fault

by termix (Beadle)
on May 30, 2002 at 18:38 UTC ( [id://170471]=note: print w/replies, xml ) Need Help??


in reply to segmentation fault - whose fault

There are many parties involved in making your Perl Program work and any one of them could be the culprit. Consider the following:

  • There is the Perl interpreter. It has "autovivification" which would allow it to create structures as needed (so as to avoid ending up in areas that do not exist). I would not make it the first suspect though. It has been around longer than any program I have written. And people out there aren't having regular seg fault problems.
  • You might be using "exec" to run another program and that program might have the segmentation fault. But if it is a simple script, then that might not be applicable.
  • You are probably using a module that has pieces coded in other languages. This is the case for example if you are using a Perl module that is a wrapper around a C library. This leaves your Perl program open to seg faults in the C library. You might be sending parameters to your module that don't work for the C module and something bad ends up happening in that part of the code.
  • When Perl was compiled on your system, or when the modules used were compiled and installed, there were problems that were not detected or ignored and therefore in certain circumstances, the program dies.

So as we see, we have a bit of a way to go before we blame the Perl interpreter for this one. As far as "Garbage collection", you have to keep your expectations realistic. You cannot write a Perl script to keep allocating memory and things to work hunky dory because, well you don't have a machine with infinite memory (unless I am really out of touch with chip tech).

-- termix

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found