Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thank you for this enlightenment. I'm learning Perl all the time. I don't know what should be happening, why there is a difference until reading your reply. I tested with require POSIX and POSIX::_exit(0) placed at the end of the script. The MCE and MCE::Hobo modules call kill 9 when posix_exit => 1 is given for minimum consumption so not having to load POSIX before spawning workers.

use strict; use warnings; $| = 1; my $size = 2e6; my $data = [ 'AGCTCGTTGTTCGATCCA', 'GAGAGATAGATGATAGTG', 'TTTT_CCCC', 0 ]; print "begin\n"; my %barcode_hash = map { $_ => $data } 1 .. $size; print "end\n"; require POSIX; POSIX::_exit(0);

Calling POSIX::_exit(0) seems helpful for scripts making a big array or hash. Regarding MCE, it means having to call MCE::Loop->finish or $mce->shutdown explicitly so that socket handles and what not are released immediately and not linger around until the OS releases them. Regarding MCE::Shared, calling MCE::Shared->stop prior to exiting.

Thank you, Anonymous_Monk. I never thought to call POSIX::_exit(0) from the main process. That works out well. I'm going to take the next hour or so and update the few examples in reply to karlgoethebier's post. Out to the rescue for this wonderful Monk++. All credits to you++ for explaining what's going on.

Regards, Mario.

Update: Oh my. I like having the destructors run in the event omitting calling MCE::Loop->finish or $mce->shutdown. It's nice that Perl gives us the option to declare a variable global when having to construct a very big array or hash and still have destructors run.

In reply to Re^2: my versus our, why is my slower when script ends (global cleanup) by marioroy
in thread my versus our, why is my slower when script ends (global cleanup) by marioroy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2023-06-06 02:26 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (26 votes). Check out past polls.