In general, when a new thread starts it gets a private copy of each existing variable (see threads::shared). In OS's that utilise copy-on-write (e.g. Linux) the effect of this may not be immediate although Perl does try to make private copies. It's good practice before starting a thread (or 35 of them) destroy all unwanted data from memory.

You mention you are using Thread::Queue. Its doc states in https://perldoc.perl.org/Thread::Queue#DESCRIPTION that

Ordinary scalars are added to queues as they are. If not already thread-shared, the other complex data types will be cloned (recursively, if needed, and including any blessings and read-only settings) into thread-shared structures before being placed onto a queue.

As I understand it, your data going into the queue must be declared :shared otherwise it will be duplicated and then :shared 35 times.

bw, bliako


In reply to Re: need help debugging perl script killed by SIGKILL by bliako
in thread need help debugging perl script killed by SIGKILL by expo1967

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.