Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: How aggressively does Perl clean up when you exit()?

by Fletch (Chancellor)
on Nov 14, 2001 at 21:25 UTC ( #125372=note: print w/replies, xml ) Need Help??

in reply to How aggressively does Perl clean up when you exit()?

If your OS doesn't clean up that type of stuff when a process exits, you probably should get a better OS. The only things I could think wouldn't get cleaned up automagically would be things like shared memory or semaphores, and you could possibly have lingering socket connections in TIME_WAIT states depending on how you set your socket options.

  • Comment on Re: How aggressively does Perl clean up when you exit()?

Replies are listed 'Best First'.
Re: Re: How aggressively does Perl clean up when you exit()?
by Rex(Wrecks) (Curate) on Nov 14, 2001 at 22:15 UTC
    I doubt there will be lingering socket connections since those are treated as FileHandles and all FileHandles should be wiped. Shared memory can be nuked by putting in this catching the INT signal like this:

    $SIG{INT} = sub { IPC::Shareable->clean_up_all ; exit 0;} ;

    You might want to catch other signals as well for this, however this catches everything I have ever run into except a perl core dump.

    Update: Hmmm, crazyinsomniac has said that you can't/shouldn't exit when catching INT. I will take his word on it, as he has been perling longer than I I'm sure. However this has been working for me in an existing implementation, maybey I'm bound for a crash!! I'll have to debug it futher.

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
      Try a different signal or better yet setup an END{} See perlfunc:exit.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2018-12-19 02:31 GMT
Find Nodes?
    Voting Booth?
    How many stories does it take before you've heard them all?

    Results (83 votes). Check out past polls.