By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 3,021 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

Managed WMI memory problem

P: n/a
Hi,

I am using WMI to gather information about different computers (using win2K
and win 2K3), checking common classes and also WMI load balance. My
application runs every 1 minute and reports the status of the machines.

Upon we follow the .NET object lifetime recommendations the application is
constantly consuming more memory! The problem is on the
ManagementObjectSearch, upon we Dispose the object it seems that is not
releasing the memory.

I think is related to the dodgy managed wmi implementation as is not fully
implemented on 1.1 neither 2.0. If you google the problem you can find plenty
of people suffering the leak.

Microsoft reported that there is a memory leak on the load balance WMI and
its says that affects win2K (solved with the latest service pack), but it
does not help.

Any comments?

Regards

--
Salvador Alvarez Patuel
Exony Ltd - London, UK
Apr 20 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Please try to identify what memory leak you see, use a memory profiler like
the ClrProfiler or the VS2005 profiler. Use the performance monitor and
watch the memory (managed and unmanaged counters).
If possible post a complete sample that illustrates the issue.
Note that WMI is not implemented in managed code, the System.Management
classes are just tiny wrappers around the COM Wbem interfaces, so don't
assume the implementation is the culprit, failing to dispose is in general
the cause of memory growth, but again this isn't necessarily a leak. A
memory leak is a BUG, the memory cannot be recovered by any means other than
terminating the process.

Willy.
PS. I don't know what you mean with loadbalanced WMI, there is no such thing
I'm aware of, am I missing something.
"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
| Hi,
|
| I am using WMI to gather information about different computers (using
win2K
| and win 2K3), checking common classes and also WMI load balance. My
| application runs every 1 minute and reports the status of the machines.
|
| Upon we follow the .NET object lifetime recommendations the application is
| constantly consuming more memory! The problem is on the
| ManagementObjectSearch, upon we Dispose the object it seems that is not
| releasing the memory.
|
| I think is related to the dodgy managed wmi implementation as is not fully
| implemented on 1.1 neither 2.0. If you google the problem you can find
plenty
| of people suffering the leak.
|
| Microsoft reported that there is a memory leak on the load balance WMI and
| its says that affects win2K (solved with the latest service pack), but it
| does not help.
|
| Any comments?
|
| Regards
|
|
|
| --
| Salvador Alvarez Patuel
| Exony Ltd - London, UK
Apr 20 '06 #2

P: n/a
Hi Willy,

Thanks for your response. I have used the CLR profiler and the memory
consumption is on the ManagementObjectSearch, especially when I query the
Load balance WMI classes of the remote machine. (you can query the load
balance service, cluster service and so on). It is clear that the memory
consumption is on the WMI components because as soon as I disable the queries
the memory does not grow. I explicitly dispose my object on my finalze
section, but memory is not returned, even if I force a collect on the garbage
collector. You can create a simple to reproduce it:
1) Create a WMI connection to a remote machine
2) Create a query, if is the load balance component better otherwise any
other will reproduce the fail.
3) Perform a search
4) Enumerate the content of the returned collection
5) Dispose the object

If you only check one machine the growth is very slow, but as my application
queries 35 machines the memory growth is more exposed. If I implement the
same code in C++ using the COM libraries the fault is not reproduced. I am
using .NET 1.1 with SP1.

Before raising it as a fault I wanted to post it here to check if any other
developer experienced this problem. I work for a golden microsoft partner and
we have raised several bugs before to Microsoft who kindly deliver a special
patch.

Thanks for your time,
Regards
--
Salvador Alvarez Patuel
Exony Ltd - London, UK

"Willy Denoyette [MVP]" wrote:
Please try to identify what memory leak you see, use a memory profiler like
the ClrProfiler or the VS2005 profiler. Use the performance monitor and
watch the memory (managed and unmanaged counters).
If possible post a complete sample that illustrates the issue.
Note that WMI is not implemented in managed code, the System.Management
classes are just tiny wrappers around the COM Wbem interfaces, so don't
assume the implementation is the culprit, failing to dispose is in general
the cause of memory growth, but again this isn't necessarily a leak. A
memory leak is a BUG, the memory cannot be recovered by any means other than
terminating the process.

Willy.
PS. I don't know what you mean with loadbalanced WMI, there is no such thing
I'm aware of, am I missing something.
"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
| Hi,
|
| I am using WMI to gather information about different computers (using
win2K
| and win 2K3), checking common classes and also WMI load balance. My
| application runs every 1 minute and reports the status of the machines.
|
| Upon we follow the .NET object lifetime recommendations the application is
| constantly consuming more memory! The problem is on the
| ManagementObjectSearch, upon we Dispose the object it seems that is not
| releasing the memory.
|
| I think is related to the dodgy managed wmi implementation as is not fully
| implemented on 1.1 neither 2.0. If you google the problem you can find
plenty
| of people suffering the leak.
|
| Microsoft reported that there is a memory leak on the load balance WMI and
| its says that affects win2K (solved with the latest service pack), but it
| does not help.
|
| Any comments?
|
| Regards
|
|
|
| --
| Salvador Alvarez Patuel
| Exony Ltd - London, UK

Apr 21 '06 #3

P: n/a
I have several queries like this running without experiencing a leak. With a
leak I mean running into out-of-memory exceptions after a certain amount of
time.
I don't like the idea of the finalizer (I suppose this is what you meant
with finalize section), nor do I know without you posting some code sample
what you mean with "explicitly disposing my object", question is what
object.
Not sure if you create a single ManagementScope per remote server and run
successive queries against this scope, or whiter you create a new scope per
query (a connection per query).

Willy.

"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
| Hi Willy,
|
| Thanks for your response. I have used the CLR profiler and the memory
| consumption is on the ManagementObjectSearch, especially when I query the
| Load balance WMI classes of the remote machine. (you can query the load
| balance service, cluster service and so on). It is clear that the memory
| consumption is on the WMI components because as soon as I disable the
queries
| the memory does not grow. I explicitly dispose my object on my finalze
| section, but memory is not returned, even if I force a collect on the
garbage
| collector. You can create a simple to reproduce it:
| 1) Create a WMI connection to a remote machine
| 2) Create a query, if is the load balance component better otherwise any
| other will reproduce the fail.
| 3) Perform a search
| 4) Enumerate the content of the returned collection
| 5) Dispose the object
|
| If you only check one machine the growth is very slow, but as my
application
| queries 35 machines the memory growth is more exposed. If I implement the
| same code in C++ using the COM libraries the fault is not reproduced. I am
| using .NET 1.1 with SP1.
|
| Before raising it as a fault I wanted to post it here to check if any
other
| developer experienced this problem. I work for a golden microsoft partner
and
| we have raised several bugs before to Microsoft who kindly deliver a
special
| patch.
|
| Thanks for your time,
| Regards
|
|
| --
| Salvador Alvarez Patuel
| Exony Ltd - London, UK
|
| "Willy Denoyette [MVP]" wrote:
|
| > Please try to identify what memory leak you see, use a memory profiler
like
| > the ClrProfiler or the VS2005 profiler. Use the performance monitor and
| > watch the memory (managed and unmanaged counters).
| > If possible post a complete sample that illustrates the issue.
| > Note that WMI is not implemented in managed code, the System.Management
| > classes are just tiny wrappers around the COM Wbem interfaces, so don't
| > assume the implementation is the culprit, failing to dispose is in
general
| > the cause of memory growth, but again this isn't necessarily a leak. A
| > memory leak is a BUG, the memory cannot be recovered by any means other
than
| > terminating the process.
| >
| > Willy.
| > PS. I don't know what you mean with loadbalanced WMI, there is no such
thing
| > I'm aware of, am I missing something.
| >
| >
| > "Salvador" <Sa******@discussions.microsoft.com> wrote in message
| > news:C7**********************************@microsof t.com...
| > | Hi,
| > |
| > | I am using WMI to gather information about different computers (using
| > win2K
| > | and win 2K3), checking common classes and also WMI load balance. My
| > | application runs every 1 minute and reports the status of the
machines.
| > |
| > | Upon we follow the .NET object lifetime recommendations the
application is
| > | constantly consuming more memory! The problem is on the
| > | ManagementObjectSearch, upon we Dispose the object it seems that is
not
| > | releasing the memory.
| > |
| > | I think is related to the dodgy managed wmi implementation as is not
fully
| > | implemented on 1.1 neither 2.0. If you google the problem you can find
| > plenty
| > | of people suffering the leak.
| > |
| > | Microsoft reported that there is a memory leak on the load balance WMI
and
| > | its says that affects win2K (solved with the latest service pack), but
it
| > | does not help.
| > |
| > | Any comments?
| > |
| > | Regards
| > |
| > |
| > |
| > | --
| > | Salvador Alvarez Patuel
| > | Exony Ltd - London, UK
| >
| >
| >
Apr 21 '06 #4

P: n/a
Hi,

Is not rocket science

I keep the scope on my class

ManagementScope m_ServerScope;

//
// Creates the connection instance once
// ServerPath = \\MyRemoteMachine\root\cimv2
// ConnectionParams = Username and password
//
m_ServerScope = new ManagementScope(ServerPath.ToString(),
ConnectionParams);

//
// I keep the connection scope open, this object does not provide any
disconnect or
// dispose
//
m_ServerScope.Connect();

Then I have another thread that uses this object once every 10 seconds

//
// QUERY_GET_DYNAMIC_DISK_INFO = "SELECT Caption, Size, FreeSpace FROM
Win32_LogicalDisk WHERE DriveType = 3"
//
// Or can try with Load balance info
// QUERY_GET_DYNAMIC_NLB_INFO = "SELECT StatusCode FROM MicrosoftNLB_Node";
//

ManagementObjectSearcher Searcher = null;

try
{
//
// Prepares the query
//
ObjectQuery GeneralQuery = new ObjectQuery(QUERY_GET_DYNAMIC_DISK_INFO);

//
// Prepares the searcher
//
Searcher = new ManagementObjectSearcher(m_ServerScope, GeneralQuery);

//
// Gets the information
//
ManagementObjectCollection Information = Searcher.Get();

//
// Populates the values
//
if (Information != null && Information.Count > 0)
{
int index = 0;
m_ServerInformation.DiskName = new string[Information.Count];
m_ServerInformation.DiskSize = new ulong[Information.Count];
m_ServerInformation.DiskFreeSpace = new ulong[Information.Count];

foreach (ManagementObject Entry in Information )
{
if (Entry["Caption"] != null)
m_ServerInformation.DiskName[index] = Entry["Caption"].ToString().Trim();

if (Entry["Size"] != null)
m_ServerInformation.DiskSize[index] = Convert.ToUInt64(Entry["Size"]);

if (Entry["FreeSpace"] != null)
m_ServerInformation.DiskFreeSpace[index] =
Convert.ToUInt64(Entry["FreeSpace"]);

index++;
}
}
}
catch (Exception)
{
//
// If there is an exception it will try to reconnect
//
m_Connected = false;
}
finally
{
if (Searcher != null) Searcher.Dispose();
}
The problem is the memory consumption, is huge and consumes more and more on
every run, the service runs until it reaches the 2GB (actually cracks before
1.7Gb) limit and crashes. Once the service is stopped the memory is returned
to the OS.

Regards
--
Salvador
Exony Ltd - London, UK
"Willy Denoyette [MVP]" wrote:
I have several queries like this running without experiencing a leak. With a
leak I mean running into out-of-memory exceptions after a certain amount of
time.
I don't like the idea of the finalizer (I suppose this is what you meant
with finalize section), nor do I know without you posting some code sample
what you mean with "explicitly disposing my object", question is what
object.
Not sure if you create a single ManagementScope per remote server and run
successive queries against this scope, or whiter you create a new scope per
query (a connection per query).

Willy.

"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
| Hi Willy,
|
| Thanks for your response. I have used the CLR profiler and the memory
| consumption is on the ManagementObjectSearch, especially when I query the
| Load balance WMI classes of the remote machine. (you can query the load
| balance service, cluster service and so on). It is clear that the memory
| consumption is on the WMI components because as soon as I disable the
queries
| the memory does not grow. I explicitly dispose my object on my finalze
| section, but memory is not returned, even if I force a collect on the
garbage
| collector. You can create a simple to reproduce it:
| 1) Create a WMI connection to a remote machine
| 2) Create a query, if is the load balance component better otherwise any
| other will reproduce the fail.
| 3) Perform a search
| 4) Enumerate the content of the returned collection
| 5) Dispose the object
|
| If you only check one machine the growth is very slow, but as my
application
| queries 35 machines the memory growth is more exposed. If I implement the
| same code in C++ using the COM libraries the fault is not reproduced. I am
| using .NET 1.1 with SP1.
|
| Before raising it as a fault I wanted to post it here to check if any
other
| developer experienced this problem. I work for a golden microsoft partner
and
| we have raised several bugs before to Microsoft who kindly deliver a
special
| patch.
|
| Thanks for your time,
| Regards
|
|
| --
| Salvador Alvarez Patuel
| Exony Ltd - London, UK
|
| "Willy Denoyette [MVP]" wrote:
|
| > Please try to identify what memory leak you see, use a memory profiler
like
| > the ClrProfiler or the VS2005 profiler. Use the performance monitor and
| > watch the memory (managed and unmanaged counters).
| > If possible post a complete sample that illustrates the issue.
| > Note that WMI is not implemented in managed code, the System.Management
| > classes are just tiny wrappers around the COM Wbem interfaces, so don't
| > assume the implementation is the culprit, failing to dispose is in
general
| > the cause of memory growth, but again this isn't necessarily a leak. A
| > memory leak is a BUG, the memory cannot be recovered by any means other
than
| > terminating the process.
| >
| > Willy.
| > PS. I don't know what you mean with loadbalanced WMI, there is no such
thing
| > I'm aware of, am I missing something.
| >
| >
| > "Salvador" <Sa******@discussions.microsoft.com> wrote in message
| > news:C7**********************************@microsof t.com...
| > | Hi,
| > |
| > | I am using WMI to gather information about different computers (using
| > win2K
| > | and win 2K3), checking common classes and also WMI load balance. My
| > | application runs every 1 minute and reports the status of the
machines.
| > |
| > | Upon we follow the .NET object lifetime recommendations the
application is
| > | constantly consuming more memory! The problem is on the
| > | ManagementObjectSearch, upon we Dispose the object it seems that is
not
| > | releasing the memory.
| > |
| > | I think is related to the dodgy managed wmi implementation as is not
fully
| > | implemented on 1.1 neither 2.0. If you google the problem you can find
| > plenty
| > | of people suffering the leak.
| > |
| > | Microsoft reported that there is a memory leak on the load balance WMI
and
| > | its says that affects win2K (solved with the latest service pack), but
it
| > | does not help.
| > |
| > | Any comments?
| > |
| > | Regards
| > |
| > |
| > |
| > | --
| > | Salvador Alvarez Patuel
| > | Exony Ltd - London, UK
| >
| >
| >

Apr 26 '06 #5

P: n/a
Well, it seems that Microsoft has validated the fault, and there are another
users experiencing the same problem.

http://lab.msdn.microsoft.com/produc...b-f6c2ff903df4

I was right, is very easy to reproduce the error.

--
Salvador
Exony Ltd - London, UK
"Willy Denoyette [MVP]" wrote:
I have several queries like this running without experiencing a leak. With a
leak I mean running into out-of-memory exceptions after a certain amount of
time.
I don't like the idea of the finalizer (I suppose this is what you meant
with finalize section), nor do I know without you posting some code sample
what you mean with "explicitly disposing my object", question is what
object.
Not sure if you create a single ManagementScope per remote server and run
successive queries against this scope, or whiter you create a new scope per
query (a connection per query).

Willy.

"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
| Hi Willy,
|
| Thanks for your response. I have used the CLR profiler and the memory
| consumption is on the ManagementObjectSearch, especially when I query the
| Load balance WMI classes of the remote machine. (you can query the load
| balance service, cluster service and so on). It is clear that the memory
| consumption is on the WMI components because as soon as I disable the
queries
| the memory does not grow. I explicitly dispose my object on my finalze
| section, but memory is not returned, even if I force a collect on the
garbage
| collector. You can create a simple to reproduce it:
| 1) Create a WMI connection to a remote machine
| 2) Create a query, if is the load balance component better otherwise any
| other will reproduce the fail.
| 3) Perform a search
| 4) Enumerate the content of the returned collection
| 5) Dispose the object
|
| If you only check one machine the growth is very slow, but as my
application
| queries 35 machines the memory growth is more exposed. If I implement the
| same code in C++ using the COM libraries the fault is not reproduced. I am
| using .NET 1.1 with SP1.
|
| Before raising it as a fault I wanted to post it here to check if any
other
| developer experienced this problem. I work for a golden microsoft partner
and
| we have raised several bugs before to Microsoft who kindly deliver a
special
| patch.
|
| Thanks for your time,
| Regards
|
|
| --
| Salvador Alvarez Patuel
| Exony Ltd - London, UK
|
| "Willy Denoyette [MVP]" wrote:
|
| > Please try to identify what memory leak you see, use a memory profiler
like
| > the ClrProfiler or the VS2005 profiler. Use the performance monitor and
| > watch the memory (managed and unmanaged counters).
| > If possible post a complete sample that illustrates the issue.
| > Note that WMI is not implemented in managed code, the System.Management
| > classes are just tiny wrappers around the COM Wbem interfaces, so don't
| > assume the implementation is the culprit, failing to dispose is in
general
| > the cause of memory growth, but again this isn't necessarily a leak. A
| > memory leak is a BUG, the memory cannot be recovered by any means other
than
| > terminating the process.
| >
| > Willy.
| > PS. I don't know what you mean with loadbalanced WMI, there is no such
thing
| > I'm aware of, am I missing something.
| >
| >
| > "Salvador" <Sa******@discussions.microsoft.com> wrote in message
| > news:C7**********************************@microsof t.com...
| > | Hi,
| > |
| > | I am using WMI to gather information about different computers (using
| > win2K
| > | and win 2K3), checking common classes and also WMI load balance. My
| > | application runs every 1 minute and reports the status of the
machines.
| > |
| > | Upon we follow the .NET object lifetime recommendations the
application is
| > | constantly consuming more memory! The problem is on the
| > | ManagementObjectSearch, upon we Dispose the object it seems that is
not
| > | releasing the memory.
| > |
| > | I think is related to the dodgy managed wmi implementation as is not
fully
| > | implemented on 1.1 neither 2.0. If you google the problem you can find
| > plenty
| > | of people suffering the leak.
| > |
| > | Microsoft reported that there is a memory leak on the load balance WMI
and
| > | its says that affects win2K (solved with the latest service pack), but
it
| > | does not help.
| > |
| > | Any comments?
| > |
| > | Regards
| > |
| > |
| > |
| > | --
| > | Salvador Alvarez Patuel
| > | Exony Ltd - London, UK
| >
| >
| >

Apr 27 '06 #6

P: n/a
This is an old problem that keeps showing it's ugly head. It was corrected
in V1.1 SP1, but apparantly it didn't make it in V2.
I voted on the bug.

Willy.

"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
| Well, it seems that Microsoft has validated the fault, and there are
another
| users experiencing the same problem.
|
|
http://lab.msdn.microsoft.com/produc...b-f6c2ff903df4
|
| I was right, is very easy to reproduce the error.
|
| --
| Salvador
| Exony Ltd - London, UK
|
|
| "Willy Denoyette [MVP]" wrote:
|
| > I have several queries like this running without experiencing a leak.
With a
| > leak I mean running into out-of-memory exceptions after a certain amount
of
| > time.
| > I don't like the idea of the finalizer (I suppose this is what you meant
| > with finalize section), nor do I know without you posting some code
sample
| > what you mean with "explicitly disposing my object", question is what
| > object.
| > Not sure if you create a single ManagementScope per remote server and
run
| > successive queries against this scope, or whiter you create a new scope
per
| > query (a connection per query).
| >
| > Willy.
| >
| >
| >
| > "Salvador" <Sa******@discussions.microsoft.com> wrote in message
| > news:EB**********************************@microsof t.com...
| > | Hi Willy,
| > |
| > | Thanks for your response. I have used the CLR profiler and the memory
| > | consumption is on the ManagementObjectSearch, especially when I query
the
| > | Load balance WMI classes of the remote machine. (you can query the
load
| > | balance service, cluster service and so on). It is clear that the
memory
| > | consumption is on the WMI components because as soon as I disable the
| > queries
| > | the memory does not grow. I explicitly dispose my object on my finalze
| > | section, but memory is not returned, even if I force a collect on the
| > garbage
| > | collector. You can create a simple to reproduce it:
| > | 1) Create a WMI connection to a remote machine
| > | 2) Create a query, if is the load balance component better otherwise
any
| > | other will reproduce the fail.
| > | 3) Perform a search
| > | 4) Enumerate the content of the returned collection
| > | 5) Dispose the object
| > |
| > | If you only check one machine the growth is very slow, but as my
| > application
| > | queries 35 machines the memory growth is more exposed. If I implement
the
| > | same code in C++ using the COM libraries the fault is not reproduced.
I am
| > | using .NET 1.1 with SP1.
| > |
| > | Before raising it as a fault I wanted to post it here to check if any
| > other
| > | developer experienced this problem. I work for a golden microsoft
partner
| > and
| > | we have raised several bugs before to Microsoft who kindly deliver a
| > special
| > | patch.
| > |
| > | Thanks for your time,
| > | Regards
| > |
| > |
| > | --
| > | Salvador Alvarez Patuel
| > | Exony Ltd - London, UK
| > |
| > | "Willy Denoyette [MVP]" wrote:
| > |
| > | > Please try to identify what memory leak you see, use a memory
profiler
| > like
| > | > the ClrProfiler or the VS2005 profiler. Use the performance monitor
and
| > | > watch the memory (managed and unmanaged counters).
| > | > If possible post a complete sample that illustrates the issue.
| > | > Note that WMI is not implemented in managed code, the
System.Management
| > | > classes are just tiny wrappers around the COM Wbem interfaces, so
don't
| > | > assume the implementation is the culprit, failing to dispose is in
| > general
| > | > the cause of memory growth, but again this isn't necessarily a leak.
A
| > | > memory leak is a BUG, the memory cannot be recovered by any means
other
| > than
| > | > terminating the process.
| > | >
| > | > Willy.
| > | > PS. I don't know what you mean with loadbalanced WMI, there is no
such
| > thing
| > | > I'm aware of, am I missing something.
| > | >
| > | >
| > | > "Salvador" <Sa******@discussions.microsoft.com> wrote in message
| > | > news:C7**********************************@microsof t.com...
| > | > | Hi,
| > | > |
| > | > | I am using WMI to gather information about different computers
(using
| > | > win2K
| > | > | and win 2K3), checking common classes and also WMI load balance.
My
| > | > | application runs every 1 minute and reports the status of the
| > machines.
| > | > |
| > | > | Upon we follow the .NET object lifetime recommendations the
| > application is
| > | > | constantly consuming more memory! The problem is on the
| > | > | ManagementObjectSearch, upon we Dispose the object it seems that
is
| > not
| > | > | releasing the memory.
| > | > |
| > | > | I think is related to the dodgy managed wmi implementation as is
not
| > fully
| > | > | implemented on 1.1 neither 2.0. If you google the problem you can
find
| > | > plenty
| > | > | of people suffering the leak.
| > | > |
| > | > | Microsoft reported that there is a memory leak on the load balance
WMI
| > and
| > | > | its says that affects win2K (solved with the latest service pack),
but
| > it
| > | > | does not help.
| > | > |
| > | > | Any comments?
| > | > |
| > | > | Regards
| > | > |
| > | > |
| > | > |
| > | > | --
| > | > | Salvador Alvarez Patuel
| > | > | Exony Ltd - London, UK
| > | >
| > | >
| > | >
| >
| >
| >
Apr 27 '06 #7

P: n/a
I found a workaround creating my own COM wrappers. this will save
my neck until microsoft decides to fix it.

Thanks for your time Willy,

Best regards
--
Salvador Alvarez Patuel
Exony Ltd - London, UK
"Willy Denoyette [MVP]" wrote:
This is an old problem that keeps showing it's ugly head. It was corrected
in V1.1 SP1, but apparantly it didn't make it in V2.
I voted on the bug.

Willy.

"Salvador" <Sa******@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
| Well, it seems that Microsoft has validated the fault, and there are
another
| users experiencing the same problem.
|
|
http://lab.msdn.microsoft.com/produc...b-f6c2ff903df4
|
| I was right, is very easy to reproduce the error.
|
| --
| Salvador
| Exony Ltd - London, UK
|
|
| "Willy Denoyette [MVP]" wrote:
|
| > I have several queries like this running without experiencing a leak.
With a
| > leak I mean running into out-of-memory exceptions after a certain amount
of
| > time.
| > I don't like the idea of the finalizer (I suppose this is what you meant
| > with finalize section), nor do I know without you posting some code
sample
| > what you mean with "explicitly disposing my object", question is what
| > object.
| > Not sure if you create a single ManagementScope per remote server and
run
| > successive queries against this scope, or whiter you create a new scope
per
| > query (a connection per query).
| >
| > Willy.
| >
| >
| >
| > "Salvador" <Sa******@discussions.microsoft.com> wrote in message
| > news:EB**********************************@microsof t.com...
| > | Hi Willy,
| > |
| > | Thanks for your response. I have used the CLR profiler and the memory
| > | consumption is on the ManagementObjectSearch, especially when I query
the
| > | Load balance WMI classes of the remote machine. (you can query the
load
| > | balance service, cluster service and so on). It is clear that the
memory
| > | consumption is on the WMI components because as soon as I disable the
| > queries
| > | the memory does not grow. I explicitly dispose my object on my finalze
| > | section, but memory is not returned, even if I force a collect on the
| > garbage
| > | collector. You can create a simple to reproduce it:
| > | 1) Create a WMI connection to a remote machine
| > | 2) Create a query, if is the load balance component better otherwise
any
| > | other will reproduce the fail.
| > | 3) Perform a search
| > | 4) Enumerate the content of the returned collection
| > | 5) Dispose the object
| > |
| > | If you only check one machine the growth is very slow, but as my
| > application
| > | queries 35 machines the memory growth is more exposed. If I implement
the
| > | same code in C++ using the COM libraries the fault is not reproduced.
I am
| > | using .NET 1.1 with SP1.
| > |
| > | Before raising it as a fault I wanted to post it here to check if any
| > other
| > | developer experienced this problem. I work for a golden microsoft
partner
| > and
| > | we have raised several bugs before to Microsoft who kindly deliver a
| > special
| > | patch.
| > |
| > | Thanks for your time,
| > | Regards
| > |
| > |
| > | --
| > | Salvador Alvarez Patuel
| > | Exony Ltd - London, UK
| > |
| > | "Willy Denoyette [MVP]" wrote:
| > |
| > | > Please try to identify what memory leak you see, use a memory
profiler
| > like
| > | > the ClrProfiler or the VS2005 profiler. Use the performance monitor
and
| > | > watch the memory (managed and unmanaged counters).
| > | > If possible post a complete sample that illustrates the issue.
| > | > Note that WMI is not implemented in managed code, the
System.Management
| > | > classes are just tiny wrappers around the COM Wbem interfaces, so
don't
| > | > assume the implementation is the culprit, failing to dispose is in
| > general
| > | > the cause of memory growth, but again this isn't necessarily a leak.
A
| > | > memory leak is a BUG, the memory cannot be recovered by any means
other
| > than
| > | > terminating the process.
| > | >
| > | > Willy.
| > | > PS. I don't know what you mean with loadbalanced WMI, there is no
such
| > thing
| > | > I'm aware of, am I missing something.
| > | >
| > | >
| > | > "Salvador" <Sa******@discussions.microsoft.com> wrote in message
| > | > news:C7**********************************@microsof t.com...
| > | > | Hi,
| > | > |
| > | > | I am using WMI to gather information about different computers
(using
| > | > win2K
| > | > | and win 2K3), checking common classes and also WMI load balance.
My
| > | > | application runs every 1 minute and reports the status of the
| > machines.
| > | > |
| > | > | Upon we follow the .NET object lifetime recommendations the
| > application is
| > | > | constantly consuming more memory! The problem is on the
| > | > | ManagementObjectSearch, upon we Dispose the object it seems that
is
| > not
| > | > | releasing the memory.
| > | > |
| > | > | I think is related to the dodgy managed wmi implementation as is
not
| > fully
| > | > | implemented on 1.1 neither 2.0. If you google the problem you can
find
| > | > plenty
| > | > | of people suffering the leak.
| > | > |
| > | > | Microsoft reported that there is a memory leak on the load balance
WMI
| > and
| > | > | its says that affects win2K (solved with the latest service pack),
but
| > it
| > | > | does not help.
| > | > |
| > | > | Any comments?
| > | > |
| > | > | Regards
| > | > |
| > | > |
| > | > |
| > | > | --
| > | > | Salvador Alvarez Patuel
| > | > | Exony Ltd - London, UK
| > | >
| > | >
| > | >
| >
| >
| >

Apr 29 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.