|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20100 Com Performance/Memory issues
Submitted: 2002-10-25 18:27 UTC Modified: 2003-02-08 01:01 UTC
From: grangeway at blueyonder dot co dot uk Assigned:
Status: No Feedback Package: COM related
PHP Version: 4CVS-2002-10-25 OS: win2k
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: grangeway at blueyonder dot co dot uk
New email:
PHP Version: OS:


 [2002-10-25 18:27 UTC] grangeway at blueyonder dot co dot uk
vbscript code:

wscript.echo now
For I = 1 To 3000
set ru=GetObject("WinMgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_NetworkAdapterConfiguration")
set ru = nothing
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++){
$Services = new COM("winmgmts:{impersonationLevel=impersonate}") or die("glump");
$NetworkAdapterSet = $Services->InstancesOf('Win32_NetworkAdapterConfiguration');

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...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-30 11:33 UTC] preston dot bannister at cox dot net
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().
 [2003-01-18 16:07 UTC]
beside that i don't have enough time to hunt memleaks in php4 code i want to note that this was qa code and not production code. php5 has a much better architecture to prevent such flaws.

 [2003-01-29 20:07 UTC]
paul can you retest please
 [2003-02-08 01:01 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 01:01:29 2024 UTC