ID: 20100
Comment by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: COM related
Operating System: win2k
PHP Version: 4CVS-2002-10-25
New Comment:
Just a comment. As I understand PHP is meant to be optimal at handling
HTTP requests. This implies a relatively short period of processing
after which the script exits.
This processing model implies that a lazy approach to garbage
collection is going to be most often optimal. Or to put it
differently, all the garbage is collected when the script exits.
If handling better the case described here means the usual case is less
optimal then perhaps this behaviour should stay as-is? Allocating and
freeing huge numbers of largish (~10KB) COM objects is unusual usage.
BTW - it might be a more exact example if the vbscript code used
CreateObject() rather than GetObject().
Previous Comments:
------------------------------------------------------------------------
[2002-10-25 18:27:24] [EMAIL PROTECTED]
vbscript code:
wscript.echo now
For I = 1 To 3000
set
ru=GetObject("WinMgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_NetworkAdapterConfiguration")
set ru = nothing
Next
wscript.echo now
vbscript output:
C:\php\wmi>cscript wmi.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
26/10/2002 00:07:26
26/10/2002 00:08:16
php code:
$prof = new Profiler;
for ($i=0;$i<3000;$i++){
$prof->startTimer($i);
$Services = new COM("winmgmts:{impersonationLevel=impersonate}") or
die("glump");
$NetworkAdapterSet =
$Services->InstancesOf('Win32_NetworkAdapterConfiguration');
$NetworkAdapterSet->release();
$Services->release();
unset($Services);
unset($NetworkAdapterSet);
$prof->stopTimer($i);
}
php results:
C:\php\snaps\php4-win32-latest>php c:\php\wmi\wmiperf.php
Warning: (null)(): Invoke() failed: Exception occurred.
<b>Source</b>: SWbemServices <b>Description</b>: Generic failure
in c:\php\wmi\wmiperf.php on line 7
Fatal error: Call to a member function on a non-object in
c:\php\wmi\wmiperf.php
on line 8
doing it as 3 seperate runs yielded:
0-1000 runs: 11313.1239 ms (100.00 %) OVERALL TIME
1000-2000 runs: 23879.2120 ms (100.00 %) OVERALL TIME
2000-3000: 544210.0750 ms (100.00 %) OVERALL TIME
At the same time, memory utilization of winmgmt.exe rises to ~30mb from
the normal 4mb...
Looks like something isn't getting freed right...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20100&edit=1