473,544 Members | 550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Managed WMI memory problem

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
ManagementObjec tSearch, 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
7 6918
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.Manageme nt
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******@discu ssions.microsof t.com> wrote in message
news:C7******** *************** ***********@mic rosoft.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
| ManagementObjec tSearch, 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
Hi Willy,

Thanks for your response. I have used the CLR profiler and the memory
consumption is on the ManagementObjec tSearch, 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.Manageme nt
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******@discu ssions.microsof t.com> wrote in message
news:C7******** *************** ***********@mic rosoft.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
| ManagementObjec tSearch, 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
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******@discu ssions.microsof t.com> wrote in message
news:EB******** *************** ***********@mic rosoft.com...
| Hi Willy,
|
| Thanks for your response. I have used the CLR profiler and the memory
| consumption is on the ManagementObjec tSearch, 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.Manageme nt
| > 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******@discu ssions.microsof t.com> wrote in message
| > news:C7******** *************** ***********@mic rosoft.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
| > | ManagementObjec tSearch, 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
Hi,

Is not rocket science

I keep the scope on my class

ManagementScope m_ServerScope;

//
// Creates the connection instance once
// ServerPath = \\MyRemoteMachi ne\root\cimv2
// ConnectionParam s = Username and password
//
m_ServerScope = new ManagementScope (ServerPath.ToS tring(),
ConnectionParam s);

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

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

//
// QUERY_GET_DYNAM IC_DISK_INFO = "SELECT Caption, Size, FreeSpace FROM
Win32_LogicalDi sk WHERE DriveType = 3"
//
// Or can try with Load balance info
// QUERY_GET_DYNAM IC_NLB_INFO = "SELECT StatusCode FROM MicrosoftNLB_No de";
//

ManagementObjec tSearcher Searcher = null;

try
{
//
// Prepares the query
//
ObjectQuery GeneralQuery = new ObjectQuery(QUE RY_GET_DYNAMIC_ DISK_INFO);

//
// Prepares the searcher
//
Searcher = new ManagementObjec tSearcher(m_Ser verScope, GeneralQuery);

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

//
// Populates the values
//
if (Information != null && Information.Cou nt > 0)
{
int index = 0;
m_ServerInforma tion.DiskName = new string[Information.Cou nt];
m_ServerInforma tion.DiskSize = new ulong[Information.Cou nt];
m_ServerInforma tion.DiskFreeSp ace = new ulong[Information.Cou nt];

foreach (ManagementObje ct Entry in Information )
{
if (Entry["Caption"] != null)
m_ServerInforma tion.DiskName[index] = Entry["Caption"].ToString().Tri m();

if (Entry["Size"] != null)
m_ServerInforma tion.DiskSize[index] = Convert.ToUInt6 4(Entry["Size"]);

if (Entry["FreeSpace"] != null)
m_ServerInforma tion.DiskFreeSp ace[index] =
Convert.ToUInt6 4(Entry["FreeSpace"]);

index++;
}
}
}
catch (Exception)
{
//
// If there is an exception it will try to reconnect
//
m_Connected = false;
}
finally
{
if (Searcher != null) Searcher.Dispos e();
}
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******@discu ssions.microsof t.com> wrote in message
news:EB******** *************** ***********@mic rosoft.com...
| Hi Willy,
|
| Thanks for your response. I have used the CLR profiler and the memory
| consumption is on the ManagementObjec tSearch, 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.Manageme nt
| > 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******@discu ssions.microsof t.com> wrote in message
| > news:C7******** *************** ***********@mic rosoft.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
| > | ManagementObjec tSearch, 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
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******@discu ssions.microsof t.com> wrote in message
news:EB******** *************** ***********@mic rosoft.com...
| Hi Willy,
|
| Thanks for your response. I have used the CLR profiler and the memory
| consumption is on the ManagementObjec tSearch, 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.Manageme nt
| > 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******@discu ssions.microsof t.com> wrote in message
| > news:C7******** *************** ***********@mic rosoft.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
| > | ManagementObjec tSearch, 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
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******@discu ssions.microsof t.com> wrote in message
news:3C******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
| > news:EB******** *************** ***********@mic rosoft.com...
| > | Hi Willy,
| > |
| > | Thanks for your response. I have used the CLR profiler and the memory
| > | consumption is on the ManagementObjec tSearch, 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.Manageme nt
| > | > 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******@discu ssions.microsof t.com> wrote in message
| > | > news:C7******** *************** ***********@mic rosoft.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
| > | > | ManagementObjec tSearch, 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
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******@discu ssions.microsof t.com> wrote in message
news:3C******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
| > news:EB******** *************** ***********@mic rosoft.com...
| > | Hi Willy,
| > |
| > | Thanks for your response. I have used the CLR profiler and the memory
| > | consumption is on the ManagementObjec tSearch, 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.Manageme nt
| > | > 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******@discu ssions.microsof t.com> wrote in message
| > | > news:C7******** *************** ***********@mic rosoft.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
| > | > | ManagementObjec tSearch, 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1931
by: Marek Malowidzki | last post by:
Hi all, I am writing a component that exposes a C++ library as a .NET component. The approach is somewhat automatic: every library C++ class has its managed C++ counterpart that keeps a pointer to the unmanaged class instance. As usually in such a scenario, the IDisposable/Dispose()/Dispose(bool) pattern should be used. The problem is...
2
2277
by: Weston Fryatt | last post by:
(Sorry for spamming multiple groups, But I need a solution to this problem) I think this should be a simple question on Memory Allocation in a managed DLL and passing a memory pointer over to an unmanaged DLL. I have a "Unmanaged" Client DLL that I'm creating a Managed "wrapper" to be used in VB.Net and/or C#.. In the my Client DLL...
0
3886
by: Frank Lopez | last post by:
Does anyone know if Microsoft generated a whitepaper on this topic? Does anyone know what the solution is? (meaning, eliminate the leak problem -- I am seeing three memory leaks from dllmodul.cpp(102) similar to what is mentioned below)... I am calling MFC as part of unmanaged code used by the managed code. +--------
3
3490
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust ------------------------------------------------------------------------
0
3327
by: Ewart MacLucas | last post by:
generated some WMI managed classes using the downloadable extensions for vs2003 from mircrosoft downloads; wrote some test code to enumerate the physicall processors and it works a treat, but a question.. The code fails with the error that: "Additional information: COM object that has been separated from its underlying RCW can not be used."...
3
14477
by: vijay.gandhi | last post by:
Hi, I am trying to convert some unmanaged code (C++) to managed code (using C++/CLI). 1) One of the functions used returns a void* which I need to cast into a handle of a managed object. Can somebody please tell me how. Actually, the function that returns a void* is a part of a MFC class - CPtrList, used in my unmanaged code. I was...
3
2198
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm trying to specify the requirement from unmanaged DLL component that will be used by a managed application written in C#. The unmanaged DLL is implementing some kind of algorithm for defect detection that will generate results. Each defect result should be a structure containing the data of the found defect. The number of defect is known...
20
2272
by: =?Utf-8?B?VGhlTWFkSGF0dGVy?= | last post by:
Sorry to bring up a topic that is just flogging a dead horse.... but... On the topic of memory management.... I am doing some file parcing that has to be done as quick as posible, but what I have found hasnt been encouraging... I found that the *quickest* way is to use a struct to retrieve fixed length packets out of the file, but structs...
66
3285
by: John | last post by:
Hi What are the advantages actually achieved of managed code? I am not talking of theory but in reality. Thanks Regards
0
7424
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7772
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5909
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4918
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3409
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1841
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
988
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
661
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.