Hi monks. Can anybody help me?
I have programm with thread (look there little piece of it)
#packages what uses use HTTP::Daemon; use LWP::UserAgent; use URI::Escape; use threads; use threads::shared; #packages what uses $DEBUG = 1; share(%LC); share(%Last); # Create socket for ICP-server $ICP_PORT=3130; $SOCKADDR = 'S n a4 x8'; socket(S, 2, 2, 17) || socket(S, 2, 1, 17) || die "Couldn't get ICP-so +cket: $!"; $us = pack($SOCKADDR, 2, $ICP_PORT, pack("C4", 0,0,0,0)); bind(S, $us) || die "Couldn't bind ICP-socket: $!"; # Create ICP-log file if (! -e "icp_access.log") { open(ICP,">icp_access.log") || die "cant create icp_access.log"; close(ICP); } # Create ICP threads $ICP_Thread = threads->new(\&ICPserver); threads->yield(); threads->list(); while(1){} ###################################################################### #ICP thread ###################################################################### sub ICPserver { my $i = 0 ; while(1) { # $theiraddr = recv(S, $ICP_request, 1024, 0); $i++; $ICP_request ="request $i"; if ($DEBUG) {print "ICP request: $ICP_request\n";} $ICP_Search = threads->new(\&ICPrequest, $ICP_request ); $ICP_Search->detach(); # only wait for($z=0;$z<10000;$z++){$t=$z;} } } sub ICPrequest{ my $ICP_request = shift; $ICP_request =~ /request (\d+)/; if ($DEBUG) {print "result for $1\n";} if ($DEBUG) {print "thread is ended\n";} # MUST CLEAN UP? }
even this example fast leak memory and down in core.
may be problem in my system?
this tested on FreeBSD 4.7 and Perl 5.8.0 Perl 5.8.1
or problem in packages
Can somebody explain it? What i doing wrong?

In reply to leak memory in threads by Anonymous Monk

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.