# New Ticket Created by Andrew Savige # Please include the string: [perl #30062] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=30062 >
The test program below demonstrates a Windows handle leak. Checking with sysinternals Handle utility, available at: http://www.sysinternals.com/ntw2k/freeware/handle.shtml indicates there are about 1000 open Win32 thread handles at the time of the sleep(60) below. (You can also check the open handle count via Windows Task Manager or other tool). -----------snip------------snip------------snip----------------------- #!/usr/bin/perl -w use strict; use threads; sub do_one_thread { warn "in kid\n" } sub do_thread { my $t = threads->new(\&do_one_thread); warn "parent $$: waiting for join\n"; $t->join(); warn "parent $$: thread exited\n"; } for my $i (1..1000) { warn "i=$i:---\n"; do_thread(); } warn "sleeping for 60 seconds (check handle count in Task Manager)\n"; sleep(60); -----------snip------------snip------------snip----------------------- Note: If you replace: $t->join(); above with: $t->detach(); the handle leak goes away. /-\ --- Flags: category= severity= --- Site configuration information for perl v5.8.4: Configured by andrews at Sun Jun 6 11:34:57 2004. Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\vperl\lib\CORE" -machine:x86' libpth="C:\Program Files\Microsoft Visual Studio\VC98\lib" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\vperl\lib\CORE" -machine:x86' Locally applied patches: --- @INC for perl v5.8.4: C:/vperl/lib C:/vperl/site/lib . --- Environment for perl v5.8.4: HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\vperl\bin;C:\tools\bin;C:\Program Files\Microsoft Visual Studio\common\msdev98\BIN;C:\Program Files\Microsoft Visual Studio\VC98\BIN;C:\Program Files\Microsoft Visual Studio\common\TOOLS\WINNT;C:\Program Files\Microsoft Visual Studio\common\TOOLS;C:\windows\system32;C:\windows;C:\windows\system32\WBEM PERL_BADLANG (unset) SHELL (unset) Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com