memory leak has nothing to do with socket, but to do with threads.

That's a bold assertion. And if you're happy that you're correct. Dump threads and use something else.

But, on recent builds, threads don't leak on their own.

Run this on 5.10.1 and you'll see the memory usage wobble up and down a bit (around ~5.5MB on my system), as new threads are created and old ones are destroyed. But in few minutes it creates and destroys 100,000+ threads and the memory use is essentially static:

perl -Mthreads -E"{ async{ print qq[\r], threads->tid; }->detach; sele +ct'','','',0.001; redo}"

What often does cause leaks is the way people use threads.

And if you want some help, you're going to have to show me what you are doing in your code. Ie. Show me the code so that I can run it.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

In reply to Re^5: Perl threads memory leak with socket and solutions I tried... by BrowserUk
in thread Perl threads memory leak with socket and solutions I tried... by ilxl

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.