Memory Leak with WMI
From: Don Nell (donnell_at_nospam.com)
Date: 03/16/05
- Next message: hafezrabbani_at_gmail.com: "DBgrid and Mouse Wheel"
- Previous message: Rob Kennedy: "Re: Using TNT components in Borland 2005"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Mar 2005 03:02:16 GMT
Hello
Why is there a memory leak when the procedure "MakeConnection" is called
repeatedly in a loop.
unit WmiDelphiTest;
interface
uses Wbemads;
procedure MakeConnection ();
implementation
procedure MakeConnection ();
var
WbemLocator: ISWbemLocator;
pService: ISWbemServices;
begin
WbemLocator := CoSWbemLocator.create;
pService := WbemLocator.ConnectServer('MachineName', 'root\cimv2',
'UserName', 'Password', '', '', 0, pService);
end;
end.
There is no leak if the username and password is blank and the computer is
in a domain. At first I thought it had something to do with Windows'
inablility to release more than 9 security context entries per 10 seconds
(see link below), but the leak still exist when I slow it down.
http://support.microsoft.com/default.aspx?scid=kb;en-us;890196
I also tried calling RpcMgmtEnableIdleCleanup() at startup and also forcing
any unused memory back to the operating system with
SetProcessWorkingSetSize(...) but nothing helps. The Windows task manger
always shows my application consuming more and more memory until it finally
crashes.
Thanks.
Don
- Next message: hafezrabbani_at_gmail.com: "DBgrid and Mouse Wheel"
- Previous message: Rob Kennedy: "Re: Using TNT components in Borland 2005"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|