IO::Socket::DESTROY

Alex Bernardin (alexjb@cnet.com)
Mon, 27 Oct 1997 09:09:26 -0800 (PST)


Marc Langheinrich writes:
 > On Tue, 21 Oct 1997, Martijn Koster wrote:
 > >     sub DESTROY {}
 > > 
 > > so this is still supposed to work.
 > Well, that's exactly the point. I assumed that simply using "undef"  on my
 > IO::Socket reference would make Perl "automatically close its associated
 > files", as you quoted above. But it seems that, at least for TCP sockets,
 > Perl _doesn't_ completely close it, thus making this explicit "close
   ^ ^ ^ ^ ^ ^ ^ ^  ^ ^ ^ ^  ^ ^ ^ ^ ^ 

YES ! ! ! ! !

OK,ok, so I haven't run 'netstat' or done real low level checking.
However, with the program that I have checking thousands of URLs, I
have seen behavior consistent with what Marc describes.  For some
reason that I don't know, Perl is not being as neat as it claims it
is.  

I have suspected that there was a memory leak in one of the LWP
modules, however, if what Marc says is true, then the sockets are not
being released, which means that the UserAgent object still has open
references, which means that they are not getting destroyed when they
go out of scope, which would explain the explosive memory growth of my
program.

soooooo, does anyone have a cool solution ?

..AlexJB