Looks like very old bug with Win32::OLE (which Win32::Process::Info::WMI "uses") being not thread safe. E.g.: Re: free to wrong pool while global destruction : windows perl environment. And, yes, your example works (i.e. no such error) if Win32::Process::Info is "required" inside a sub instead of "used" globally.