Discussion:
Excess memory usage growth for a process
Eddie Lascu
2009-07-27 15:32:35 UTC
Permalink
Hi guys,



I need your help with an issue I am having right now. I have several windows
services deployed. These services gather some XML files from the internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing very
high. At the time, I understood that some classes in the ODP.NET library use
some JAVA code and they are known for not cleaning properly after them. As a
result I rewrote my code in such a way that every dynamic allocation of an
object from the ODP.NET library was encompassed in an "using" statement,
like this:



using (OracleCommand objDbCommand = new OracleCommand(strSqlSelectStatement,
objConnection))



All was fine for a very long time. All my services kept a constant size when
it came to the total memory used, a size that hovered around 55-60 MB. This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.



Now, all of a sudden, this last weekend, the size for some of the services
shut up to about 690 MB, despite the fact the service was running with the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have been a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.



Can anyone give me an idea on how to investigate this issue? Are there tools
out there that could be used to pick at the memory allocated by a process
and see what are those objects that take up so much memory? For the time
being, I have the processes running, but two of them are at or close to 690
MB and I don't know how long will I be able to keep them running.



If you had an issue like this, what would you try to do?



Any suggestion will be greatly appreciated.



TIA,

Eddie




===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
John Warner
2009-07-27 15:49:03 UTC
Permalink
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?

John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi guys,
I need your help with an issue I am having right now. I have several windows
services deployed. These services gather some XML files from the internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing very
high. At the time, I understood that some classes in the ODP.NET library use
some JAVA code and they are known for not cleaning properly after them. As a
result I rewrote my code in such a way that every dynamic allocation of an
object from the ODP.NET library was encompassed in an "using" statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant size when
it came to the total memory used, a size that hovered around 55-60 MB. This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the services
shut up to about 690 MB, despite the fact the service was running with the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have been a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there tools
out there that could be used to pick at the memory allocated by a process
and see what are those objects that take up so much memory? For the time
being, I have the processes running, but two of them are at or close to 690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-27 16:00:08 UTC
Permalink
Hi John,

I could check that with our system administrators. Do you think that can be
a possible explanation?
I just talked with one of the DB Admin and she said she made some changes on
some Stored Produces, but nothing as dramatic as a patch update. She also
said that the drivers for the network cards were updated last week, but I
can't see how that can affect the memory used by my processes.

Thanks,
Eddie


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of John Warner
Sent: Monday, July 27, 2009 11:49 AM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?

John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi guys,
I need your help with an issue I am having right now. I have several windows
services deployed. These services gather some XML files from the internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing very
high. At the time, I understood that some classes in the ODP.NET library use
some JAVA code and they are known for not cleaning properly after them. As a
result I rewrote my code in such a way that every dynamic allocation of an
object from the ODP.NET library was encompassed in an "using" statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant size when
it came to the total memory used, a size that hovered around 55-60 MB. This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the services
shut up to about 690 MB, despite the fact the service was running with the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have been a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there tools
out there that could be used to pick at the memory allocated by a process
and see what are those objects that take up so much memory? For the time
being, I have the processes running, but two of them are at or close to 690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
John Warner
2009-07-27 16:28:13 UTC
Permalink
I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did not
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?

John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She also
said that the drivers for the network cards were updated last week, but I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using" statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Shawn Wildermuth
2009-07-27 16:49:02 UTC
Permalink
Also, your 'using' statement stuff should help, but are you sure that all
your object (XML classes and db connection classes) that support IDisposable
are being cleaned up?

Thanks,

Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker

The Silverlight Tour is coming to a city near you!


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of John Warner
Sent: Monday, July 27, 2009 12:28 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did not
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?

John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She also
said that the drivers for the network cards were updated last week, but I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using" statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-29 16:33:18 UTC
Permalink
Hi guys,

In light of this article:

http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/

I am no longer sure what I have is a memory leak. I could see how some of the things that happen in my application match the scenarios described in the above article. Hence, I am ready to think about a workaround. My services are set up to run automatically and restart in case they crash. While they never crash, I could leverage that feature and use it to fix this excess memory usage that I experience every once in a blue moon. What I thought was to monitor the memory used and terminate the application in case it exceeds a set threshold. The Windows Service Manager will then restart the service and all the memory will be reclaimed by the OS.

My question at this point is whether the .NET Framework has some metric classes that can help monitor the total amount of memory allocated within a process. Surely System.Diagnostics must have something like that. Is anyone aware of a way to find out what memory is used by a process, just like the Task Manager does?

Cheers,
Eddie


-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Shawn Wildermuth
Sent: Monday, July 27, 2009 12:49 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Also, your 'using' statement stuff should help, but are you sure that all
your object (XML classes and db connection classes) that support IDisposable
are being cleaned up?

Thanks,

Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker

The Silverlight Tour is coming to a city near you!


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of John Warner
Sent: Monday, July 27, 2009 12:28 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did not
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?

John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She also
said that the drivers for the network cards were updated last week, but I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using" statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-29 16:38:23 UTC
Permalink
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).

Have you verified the LOH being the problem by using SOS?

Cheers,

Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/
I am no longer sure what I have is a memory leak. I could see how some of the things that happen in my application match the scenarios described in the above article. Hence, I am ready to think about a workaround. My services are set up to run automatically and restart in case they crash. While they never crash, I could leverage that feature and use it to fix this excess memory usage that I experience every once in a blue moon. What I thought was to monitor the memory used and terminate the application in case it exceeds a set threshold. The Windows Service Manager will then restart the service and all the memory will be reclaimed by the OS.
My question at this point is whether the .NET Framework has some metric classes that can help monitor the total amount of memory allocated within a process. Surely System.Diagnostics must have something like that. Is anyone aware of a way to find out what memory is used by a process, just like the Task Manager does?
Cheers,
Eddie
-----Original Message-----
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that all
your object (XML classes and db connection classes) that support IDisposable
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did not
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week, but
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen.
I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-29 16:43:39 UTC
Permalink
I am using Reg Gate ANTS to profile the app, but it may take too much to
happen again. Before the spike I saw last weekend, the processes ran for 3-4
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.

Thanks,
Eddie



-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Greg Young
Sent: Wednesday, July 29, 2009 12:38 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).

Have you verified the LOH being the problem by using SOS?

Cheers,

Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some of
the things that happen in my application match the scenarios described in
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they crash.
While they never crash, I could leverage that feature and use it to fix this
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in case
it exceeds a set threshold. The Windows Service Manager will then restart
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some metric
classes that can help monitor the total amount of memory allocated within a
process. Surely System.Diagnostics must have something like that. Is anyone
aware of a way to find out what memory is used by a process, just like the
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that all
your object (XML classes and db connection classes) that support IDisposable
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did not
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week, but
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen.
I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-29 16:45:57 UTC
Permalink
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much to
happen again. Before the spike I saw last weekend, the processes ran for 3-4
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some of
the things that happen in my application match the scenarios described in
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they crash.
While they never crash, I could leverage that feature and use it to fix this
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in case
it exceeds a set threshold. The Windows Service Manager will then restart
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some metric
classes that can help monitor the total amount of memory allocated within a
process. Surely System.Diagnostics must have something like that. Is anyone
aware of a way to find out what memory is used by a process, just like the
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that all
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did not
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week, but
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen.
I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-29 17:01:05 UTC
Permalink
Shoot, I didn't know SOS can do that for you. Can you share more about this
tool (a link to download it)? Is it part of the WinDbg tool that comes from
Microsoft? It's true that with ANTS I am at the mercy of the system, hoping
it will go nuts again and will have the memory size shut up crazy high.

Cheers,
Eddie



-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Greg Young
Sent: Wednesday, July 29, 2009 12:46 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much to
happen again. Before the spike I saw last weekend, the processes ran for 3-4
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some of
the things that happen in my application match the scenarios described in
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they crash.
While they never crash, I could leverage that feature and use it to fix this
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in case
it exceeds a set threshold. The Windows Service Manager will then restart
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some metric
classes that can help monitor the total amount of memory allocated within a
process. Surely System.Diagnostics must have something like that. Is anyone
aware of a way to find out what memory is used by a process, just like the
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that all
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did not
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week, but
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen.
I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-29 17:06:11 UTC
Permalink
Yes with ants you have to wait for the problem to happen.

if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.

Cheers,

greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about this
tool (a link to download it)? Is it part of the WinDbg tool that comes from
Microsoft? It's true that with ANTS I am at the mercy of the system, hoping
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much to
happen again. Before the spike I saw last weekend, the processes ran for
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some of
the things that happen in my application match the scenarios described in
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they crash.
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then restart
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some metric
classes that can help monitor the total amount of memory allocated within
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like the
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that all
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working OK
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that can
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week, but
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
John Warner
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I had
some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60 MB.
This
was the case for months. At the beginning I checked the size almost on
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I had
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running with
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to happen.
I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Adam Tuliper
2009-07-29 17:24:11 UTC
Permalink
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-0-3-5.aspx

!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
-> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much to
happen again. Before the spike I saw last weekend, the processes ran for
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they crash.
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some metric
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size almost
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit by
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-29 18:40:04 UTC
Permalink
Based on my preliminary reading of what this has to offer, it seems you can
integrate it with your VS IDE (not an option for me as my processes are
already deployed) or use it via WinDbg, but you need to look at the debug
version or the runtime version that has the .pdb file (not an option either
as I only have the sole runtime file deployed, but much easily fixable). Is
this statement accurate?

Thanks,
Eddie

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Adam Tuliper
Sent: Wednesday, July 29, 2009 1:24 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-
0-3-5.aspx

!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
-> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much to
happen again. Before the spike I saw last weekend, the processes ran for
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they crash.
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some metric
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size almost
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit by
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-29 19:35:59 UTC
Permalink
no actually not a single statement there is accurate except that you
can use it with visual studio :)

1) you don't view the dump on the same machine you take the dump on
(you take the file to another machine to go view it)
2) having a pdb does not make something a debug build (pdbs are
generated in release as well). the pdb file represents the debug
symbols for the dll.
3) you generally dont deploy pdbs (you use them when debugging dumps
from other machines)
4) For this you probably don't even need the symbols just SOS (the
type information will still be there just not links back to source
code line numbers etc).

Cheers,

Greg
Post by Eddie Lascu
Based on my preliminary reading of what this has to offer, it seems you can
integrate it with your VS IDE (not an option for me as my processes are
already deployed) or use it via WinDbg, but you need to look at the debug
version or the runtime version that has the .pdb file (not an option either
as I only have the sole runtime file deployed, but much easily fixable). Is
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes ran
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size almost
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics implemented in
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit by
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at or
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-29 19:38:36 UTC
Permalink
btw: this stuff is fairly complex and not for the feint of heart
(especially for a first timer).

You might want to consider someone local to you who maybe you could
bring on a contract with you for a day or so who has experience with
this stuff and could "show you the ropes" of SOS/debugging etc?

The book I mentioned earlier by John Robbins is a great learning
material by I understand that sometimes you can't wait for amazon.com
to show up with a book on how to learn to solve your production
problem :)

Cheers,

Greg
Post by Greg Young
no actually not a single statement there is accurate except that you
can use it with visual studio :)
1) you don't view the dump on the same machine you take the dump on
(you take the file to another machine to go view it)
2) having a pdb does not make something a debug build (pdbs are
generated in release as well). the pdb file represents the debug
symbols for the dll.
3) you generally dont deploy pdbs (you use them when debugging dumps
from other machines)
4) For this you probably don't even need the symbols just SOS (the
type information will still be there just not links back to source
code line numbers etc).
Cheers,
Greg
Post by Eddie Lascu
Based on my preliminary reading of what this has to offer, it seems you can
integrate it with your VS IDE (not an option for me as my processes are
already deployed) or use it via WinDbg, but you need to look at the debug
version or the runtime version that has the .pdb file (not an option either
as I only have the sole runtime file deployed, but much easily fixable). Is
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes ran
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size almost
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics implemented in
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit by
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at or
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Wilson, Phil
2009-07-30 17:49:36 UTC
Permalink
Not answering this particular question, but I believe you could hook all this together to automatically get that dump when the memory gets large if it's rare enough that you don't want to sit and look at it all day. Perfmon has triggers that can fire off a script, and you can fire off the debugging script ADPlus to dump your process with the -hang option.

Phil Wilson


-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Eddie Lascu
Sent: Wednesday, July 29, 2009 11:40 AM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Based on my preliminary reading of what this has to offer, it seems you can
integrate it with your VS IDE (not an option for me as my processes are
already deployed) or use it via WinDbg, but you need to look at the debug
version or the runtime version that has the .pdb file (not an option either
as I only have the sole runtime file deployed, but much easily fixable). Is
this statement accurate?

Thanks,
Eddie

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Adam Tuliper
Sent: Wednesday, July 29, 2009 1:24 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-
0-3-5.aspx

!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
-> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much to
happen again. Before the spike I saw last weekend, the processes ran for
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they crash.
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some metric
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have several
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the database.
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services growing
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic allocation
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size almost
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked it
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the heck
is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit by
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't get
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much memory? For the
time
being, I have the processes running, but two of them are at or close
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-30 17:51:50 UTC
Permalink
Yep exactly what ADPlus is meant for! you can even do this right
within ADPlus :)
Post by Wilson, Phil
Not answering this particular question, but I believe you could hook all this together to automatically get that dump when the memory gets large if it's rare enough that you don't want to sit and look at it all day. Perfmon has triggers that can fire off a script, and you can fire off the debugging script ADPlus to dump your process with the -hang option.
Phil Wilson
-----Original Message-----
Sent: Wednesday, July 29, 2009 11:40 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Based on my preliminary reading of what this has to offer, it seems you can
integrate it with your VS IDE (not an option for me as my processes are
already deployed) or use it via WinDbg, but you need to look at the debug
version or the runtime version that has the .pdb file (not an option either
as I only have the sole runtime file deployed, but much easily fixable). Is
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes ran
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size almost
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics implemented in
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit by
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at or
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-30 18:03:35 UTC
Permalink
Thank you, Guys. I will look into that as well. Do I need a special start of
the process if I am to use ADPlus or I can attach to the process later?


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Greg Young
Sent: Thursday, July 30, 2009 1:52 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Yep exactly what ADPlus is meant for! you can even do this right
within ADPlus :)
Post by Wilson, Phil
Not answering this particular question, but I believe you could hook all
this together to automatically get that dump when the memory gets large if
it's rare enough that you don't want to sit and look at it all day. Perfmon
has triggers that can fire off a script, and you can fire off the debugging
script ADPlus to dump your process with the -hang option.
Post by Wilson, Phil
Phil Wilson
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 11:40 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Based on my preliminary reading of what this has to offer, it seems you can
integrate it with your VS IDE (not an option for me as my processes are
already deployed) or use it via WinDbg, but you need to look at the debug
version or the runtime version that has the .pdb file (not an option either
as I only have the sole runtime file deployed, but much easily fixable). Is
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-
Post by Wilson, Phil
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes ran
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how some
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it to fix
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What I
thought was to monitor the memory used and terminate the application in
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code did
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size almost
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics implemented in
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That would have
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit by
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at or
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Wilson, Phil
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-30 18:06:20 UTC
Permalink
Its all later ... if its broken right now you can still use it right now!
Post by Eddie Lascu
Thank you, Guys. I will look into that as well. Do I need a special start of
the process if I am to use ADPlus or I can attach to the process later?
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Thursday, July 30, 2009 1:52 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Yep exactly what ADPlus is meant for! you can even do this right
within ADPlus :)
Post by Wilson, Phil
Not answering this particular question, but I believe you could hook all
this together to automatically get that dump when the memory gets large if
it's rare enough that you don't want to sit and look at it all day. Perfmon
has triggers that can fire off a script, and you can fire off the debugging
script ADPlus to dump your process with the -hang option.
Post by Wilson, Phil
Phil Wilson
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 11:40 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Based on my preliminary reading of what this has to offer, it seems you
can
Post by Wilson, Phil
integrate it with your VS IDE (not an option for me as my processes are
already deployed) or use it via WinDbg, but you need to look at the debug
version or the runtime version that has the .pdb file (not an option
either
Post by Wilson, Phil
as I only have the sole runtime file deployed, but much easily fixable).
Is
Post by Wilson, Phil
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-
Post by Wilson, Phil
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a separate
download from windbg ... it can also be used in visual studio!). John
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more about
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that comes
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the system,
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy high.
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
The wonderful thing about SOS is you dont need to run a profiler ...
when it happens take a memory dump, look whats actually happening in
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too much
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes ran
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Task manager shows you working set not total memory used but yes the
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-ob
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see how
some
Post by Wilson, Phil
Post by Greg Young
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios described
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround. My
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it to
fix
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon. What
I
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
thought was to monitor the memory used and terminate the application
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory allocated
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that. Is
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just like
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure that
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Warner
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change' working
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your code
did
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think that
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made some
changes
on
some Stored Produces, but nothing as dramatic as a patch update. She
also
said that the drivers for the network cards were updated last week,
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server changed? An
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from the
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through ODP.NET. I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the ODP.NET
library
use
some JAVA code and they are known for not cleaning properly after
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant
size
when
it came to the total memory used, a size that hovered around 55-60
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size
almost
Post by Wilson, Phil
Post by Greg Young
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only checked
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my processes (I
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with those
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the
services
shut up to about 690 MB, despite the fact the service was running
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a potential
fatal
problem for the server that can get to a point where it can no
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what the
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics implemented in
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That would
have
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
been
a
very good indication on when exactly did this surge started to
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got hit
by
Post by Wilson, Phil
Post by Greg Young
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really don't
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be rid of
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects are
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue? Are
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated by a
process
and see what are those objects that take up so much  memory? For
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at or
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Wilson, Phil
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Trey Nash
2009-07-30 18:24:25 UTC
Permalink
Hi,

Yes, ADPlus is really just a complex VB script that drive windb(a)g. If you
feed it the -? option, it should spew out a lot of helpful info on the
various ways you can use it.

I wrote a blog post on our team blog not too long ago regarding ADPlus that
may be helpful to become more familiar with it:

http://blogs.msdn.com/ntdebugging/archive/2009/05/18/capturing-adplus-clr-cr
ashes.aspx

I hope this helps,

-Trey
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Thursday, July 30, 2009 1:04 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Thank you, Guys. I will look into that as well. Do I need a special start of
the process if I am to use ADPlus or I can attach to the process later?
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Thursday, July 30, 2009 1:52 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Yep exactly what ADPlus is meant for! you can even do this right
within ADPlus :)
On Thu, Jul 30, 2009 at 1:49 PM, Wilson,
Post by Wilson, Phil
Not answering this particular question, but I believe you could hook
all
this together to automatically get that dump when the memory gets large if
it's rare enough that you don't want to sit and look at it all day. Perfmon
has triggers that can fire off a script, and you can fire off the debugging
script ADPlus to dump your process with the -hang option.
Post by Wilson, Phil
Phil Wilson
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 11:40 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Based on my preliminary reading of what this has to offer, it seems
you
can
Post by Wilson, Phil
integrate it with your VS IDE (not an option for me as my processes
are
Post by Wilson, Phil
already deployed) or use it via WinDbg, but you need to look at the
debug
Post by Wilson, Phil
version or the runtime version that has the .pdb file (not an option
either
Post by Wilson, Phil
as I only have the sole runtime file deployed, but much easily
fixable).
Is
Post by Wilson, Phil
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Tuliper
Post by Wilson, Phil
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-
2-0-3-
Post by Wilson, Phil
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a
separate
Post by Wilson, Phil
Post by Greg Young
download from windbg ... it can also be used in visual studio!).
John
Post by Wilson, Phil
Post by Greg Young
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more
about
Post by Wilson, Phil
Post by Greg Young
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that
comes
Post by Wilson, Phil
Post by Greg Young
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the
system,
Post by Wilson, Phil
Post by Greg Young
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy
high.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
The wonderful thing about SOS is you dont need to run a profiler
...
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
when it happens take a memory dump, look whats actually happening
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too
much
Post by Wilson, Phil
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes
ran
Post by Wilson, Phil
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Task manager shows you working set not total memory used but yes
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
On Wed, Jul 29, 2009 at 12:33 PM, Eddie
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-
large-ob
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see
how
some
Post by Wilson, Phil
Post by Greg Young
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios
described
Post by Wilson, Phil
Post by Greg Young
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround.
My
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it
to
fix
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon.
What
I
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
thought was to monitor the memory used and terminate the
application
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory
allocated
Post by Wilson, Phil
Post by Greg Young
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that.
Is
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just
like
Post by Wilson, Phil
Post by Greg Young
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure
that
Post by Wilson, Phil
Post by Greg Young
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Warner
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change'
working
Post by Wilson, Phil
Post by Greg Young
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your
code
did
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think
that
Post by Wilson, Phil
Post by Greg Young
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made
some
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
changes
on
some Stored Produces, but nothing as dramatic as a patch
update. She
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
also
said that the drivers for the network cards were updated last
week,
Post by Wilson, Phil
Post by Greg Young
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server
changed? An
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through
ODP.NET. I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the
ODP.NET
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
library
use
some JAVA code and they are known for not cleaning properly
after
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a
constant
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
size
when
it came to the total memory used, a size that hovered around
55-60
Post by Wilson, Phil
Post by Greg Young
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size
almost
Post by Wilson, Phil
Post by Greg Young
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only
checked
Post by Wilson, Phil
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my
processes (I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with
those
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
services
shut up to about 690 MB, despite the fact the service was
running
Post by Wilson, Phil
Post by Greg Young
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a
potential
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
fatal
problem for the server that can get to a point where it can
no
Post by Wilson, Phil
Post by Greg Young
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what
the
Post by Wilson, Phil
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics
implemented in
Post by Wilson, Phil
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That
would
have
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
been
a
very good indication on when exactly did this surge started
to
Post by Wilson, Phil
Post by Greg Young
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got
hit
by
Post by Wilson, Phil
Post by Greg Young
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really
don't
Post by Wilson, Phil
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be
rid of
Post by Wilson, Phil
Post by Greg Young
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects
are
Post by Wilson, Phil
Post by Greg Young
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue?
Are
Post by Wilson, Phil
Post by Greg Young
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated
by a
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
process
and see what are those objects that take up so much  memory?
For
Post by Wilson, Phil
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at
or
Post by Wilson, Phil
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them
running.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Wilson, Phil
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-08-06 19:35:19 UTC
Permalink
Hi Folks,

So I have been running this Red Gate Memory Profiler for more than 8 days
now and I can see some very interesting developments. The Profiler is
monitoring some of the Performance Counters. One in particular has caught my
interest and that is the size of Private Bytes. Although steady for the
first two days at 48 MB, after that it started to grow slowly and what was a
flat line before, turned into a ascending incline ramp. At the moment I type
this message, the size of the Private Bytes is 855 MB. In the task manager,
my process is indicated as having the Virtual Memory size up to 876 MB while
the Mem Usage is only 64 MB.
I believe this clearly indicates that there is no memory leak per se, but
rather is just that the large objects heap is growing w/o control.
Is my assessment correct?

Regards,
Eddie


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Trey Nash
Sent: Thursday, July 30, 2009 2:24 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Hi,

Yes, ADPlus is really just a complex VB script that drive windb(a)g. If you
feed it the -? option, it should spew out a lot of helpful info on the
various ways you can use it.

I wrote a blog post on our team blog not too long ago regarding ADPlus that
may be helpful to become more familiar with it:

http://blogs.msdn.com/ntdebugging/archive/2009/05/18/capturing-adplus-clr-cr
ashes.aspx

I hope this helps,

-Trey
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Thursday, July 30, 2009 1:04 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Thank you, Guys. I will look into that as well. Do I need a special start of
the process if I am to use ADPlus or I can attach to the process later?
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Thursday, July 30, 2009 1:52 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Yep exactly what ADPlus is meant for! you can even do this right
within ADPlus :)
On Thu, Jul 30, 2009 at 1:49 PM, Wilson,
Post by Wilson, Phil
Not answering this particular question, but I believe you could hook
all
this together to automatically get that dump when the memory gets large if
it's rare enough that you don't want to sit and look at it all day. Perfmon
has triggers that can fire off a script, and you can fire off the debugging
script ADPlus to dump your process with the -hang option.
Post by Wilson, Phil
Phil Wilson
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 11:40 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Based on my preliminary reading of what this has to offer, it seems
you
can
Post by Wilson, Phil
integrate it with your VS IDE (not an option for me as my processes
are
Post by Wilson, Phil
already deployed) or use it via WinDbg, but you need to look at the
debug
Post by Wilson, Phil
version or the runtime version that has the .pdb file (not an option
either
Post by Wilson, Phil
as I only have the sole runtime file deployed, but much easily
fixable).
Is
Post by Wilson, Phil
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Tuliper
Post by Wilson, Phil
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-
2-0-3-
Post by Wilson, Phil
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a
separate
Post by Wilson, Phil
Post by Greg Young
download from windbg ... it can also be used in visual studio!).
John
Post by Wilson, Phil
Post by Greg Young
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more
about
Post by Wilson, Phil
Post by Greg Young
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that
comes
Post by Wilson, Phil
Post by Greg Young
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the
system,
Post by Wilson, Phil
Post by Greg Young
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy
high.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
The wonderful thing about SOS is you dont need to run a profiler
...
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
when it happens take a memory dump, look whats actually happening
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too
much
Post by Wilson, Phil
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes
ran
Post by Wilson, Phil
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Task manager shows you working set not total memory used but yes
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
On Wed, Jul 29, 2009 at 12:33 PM, Eddie
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-
large-ob
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see
how
some
Post by Wilson, Phil
Post by Greg Young
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios
described
Post by Wilson, Phil
Post by Greg Young
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround.
My
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it
to
fix
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon.
What
I
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
thought was to monitor the memory used and terminate the
application
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory
allocated
Post by Wilson, Phil
Post by Greg Young
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that.
Is
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just
like
Post by Wilson, Phil
Post by Greg Young
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure
that
Post by Wilson, Phil
Post by Greg Young
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Warner
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change'
working
Post by Wilson, Phil
Post by Greg Young
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your
code
did
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think
that
Post by Wilson, Phil
Post by Greg Young
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made
some
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
changes
on
some Stored Produces, but nothing as dramatic as a patch
update. She
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
also
said that the drivers for the network cards were updated last
week,
Post by Wilson, Phil
Post by Greg Young
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server
changed? An
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through
ODP.NET. I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the
ODP.NET
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
library
use
some JAVA code and they are known for not cleaning properly
after
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a
constant
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
size
when
it came to the total memory used, a size that hovered around
55-60
Post by Wilson, Phil
Post by Greg Young
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size
almost
Post by Wilson, Phil
Post by Greg Young
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only
checked
Post by Wilson, Phil
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my
processes (I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with
those
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
services
shut up to about 690 MB, despite the fact the service was
running
Post by Wilson, Phil
Post by Greg Young
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a
potential
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
fatal
problem for the server that can get to a point where it can
no
Post by Wilson, Phil
Post by Greg Young
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what
the
Post by Wilson, Phil
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics
implemented in
Post by Wilson, Phil
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That
would
have
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
been
a
very good indication on when exactly did this surge started
to
Post by Wilson, Phil
Post by Greg Young
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got
hit
by
Post by Wilson, Phil
Post by Greg Young
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really
don't
Post by Wilson, Phil
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be
rid of
Post by Wilson, Phil
Post by Greg Young
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects
are
Post by Wilson, Phil
Post by Greg Young
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue?
Are
Post by Wilson, Phil
Post by Greg Young
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated
by a
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
process
and see what are those objects that take up so much  memory?
For
Post by Wilson, Phil
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at
or
Post by Wilson, Phil
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them
running.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Wilson, Phil
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-08-06 19:42:06 UTC
Permalink
Post by Eddie Lascu
I believe this clearly indicates that there is no memory leak per se, but
rather is just that the large objects heap is growing w/o control.
Is my assessment correct?
Private bytes is just how much memory your application is using that
can't be accessed by other applications.

Why does this clearly indicate anything? much less that its an "out of
control LOH". What is the size of your LOH in your memory dump? What
objects are on it? How are those objects rooted?

Cheers,

Greg
Post by Eddie Lascu
Hi Folks,
So I have been running this Red Gate Memory Profiler for more than 8 days
now and I can see some very interesting developments. The Profiler is
monitoring some of the Performance Counters. One in particular has caught my
interest and that is the size of Private Bytes. Although steady for the
first two days at 48 MB, after that it started to grow slowly and what was a
flat line before, turned into a ascending incline ramp. At the moment I type
this message, the size of the Private Bytes is 855 MB. In the task manager,
my process is indicated as having the Virtual Memory size up to 876 MB while
the Mem Usage is only 64 MB.
I believe this clearly indicates that there is no memory leak per se, but
rather is just that the large objects heap is growing w/o control.
Is my assessment correct?
Regards,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Thursday, July 30, 2009 2:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi,
Yes, ADPlus is really just a complex VB script that drive windb(a)g.  If you
feed it the -? option, it should spew out a lot of helpful info on the
various ways you can use it.
I wrote a blog post on our team blog not too long ago regarding ADPlus that
http://blogs.msdn.com/ntdebugging/archive/2009/05/18/capturing-adplus-clr-cr
ashes.aspx
I hope this helps,
       -Trey
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Thursday, July 30, 2009 1:04 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Thank you, Guys. I will look into that as well. Do I need a special start of
the process if I am to use ADPlus or I can attach to the process later?
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Thursday, July 30, 2009 1:52 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Yep exactly what ADPlus is meant for! you can even do this right
within ADPlus :)
On Thu, Jul 30, 2009 at 1:49 PM, Wilson,
Post by Wilson, Phil
Not answering this particular question, but I believe you could hook
all
this together to automatically get that dump when the memory gets large if
it's rare enough that you don't want to sit and look at it all day. Perfmon
has triggers that can fire off a script, and you can fire off the debugging
script ADPlus to dump your process with the -hang option.
Post by Wilson, Phil
Phil Wilson
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 11:40 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Based on my preliminary reading of what this has to offer, it seems
you
can
Post by Wilson, Phil
integrate it with your VS IDE (not an option for me as my processes
are
Post by Wilson, Phil
already deployed) or use it via WinDbg, but you need to look at the
debug
Post by Wilson, Phil
version or the runtime version that has the .pdb file (not an option
either
Post by Wilson, Phil
as I only have the sole runtime file deployed, but much easily
fixable).
Is
Post by Wilson, Phil
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Tuliper
Post by Wilson, Phil
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-
2-0-3-
Post by Wilson, Phil
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a
separate
Post by Wilson, Phil
Post by Greg Young
download from windbg ... it can also be used in visual studio!).
John
Post by Wilson, Phil
Post by Greg Young
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more
about
Post by Wilson, Phil
Post by Greg Young
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that
comes
Post by Wilson, Phil
Post by Greg Young
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the
system,
Post by Wilson, Phil
Post by Greg Young
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy
high.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
The wonderful thing about SOS is you dont need to run a profiler
...
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
when it happens take a memory dump, look whats actually happening
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too
much
Post by Wilson, Phil
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes
ran
Post by Wilson, Phil
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Task manager shows you working set not total memory used but yes
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
On Wed, Jul 29, 2009 at 12:33 PM, Eddie
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-
large-ob
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see
how
some
Post by Wilson, Phil
Post by Greg Young
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios
described
Post by Wilson, Phil
Post by Greg Young
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround.
My
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it
to
fix
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon.
What
I
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
thought was to monitor the memory used and terminate the
application
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory
allocated
Post by Wilson, Phil
Post by Greg Young
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that.
Is
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just
like
Post by Wilson, Phil
Post by Greg Young
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure
that
Post by Wilson, Phil
Post by Greg Young
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Warner
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change'
working
Post by Wilson, Phil
Post by Greg Young
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your
code
did
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think
that
Post by Wilson, Phil
Post by Greg Young
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made
some
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
changes
on
some Stored Produces, but nothing as dramatic as a patch
update. She
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
also
said that the drivers for the network cards were updated last
week,
Post by Wilson, Phil
Post by Greg Young
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server
changed? An
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through
ODP.NET. I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the
ODP.NET
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
library
use
some JAVA code and they are known for not cleaning properly
after
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a
constant
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
size
when
it came to the total memory used, a size that hovered around
55-60
Post by Wilson, Phil
Post by Greg Young
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size
almost
Post by Wilson, Phil
Post by Greg Young
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only
checked
Post by Wilson, Phil
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my
processes (I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with
those
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
services
shut up to about 690 MB, despite the fact the service was
running
Post by Wilson, Phil
Post by Greg Young
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a
potential
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
fatal
problem for the server that can get to a point where it can
no
Post by Wilson, Phil
Post by Greg Young
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what
the
Post by Wilson, Phil
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics
implemented in
Post by Wilson, Phil
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That
would
have
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
been
a
very good indication on when exactly did this surge started
to
Post by Wilson, Phil
Post by Greg Young
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got
hit
by
Post by Wilson, Phil
Post by Greg Young
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really
don't
Post by Wilson, Phil
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be
rid of
Post by Wilson, Phil
Post by Greg Young
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects
are
Post by Wilson, Phil
Post by Greg Young
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue?
Are
Post by Wilson, Phil
Post by Greg Young
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated
by a
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
process
and see what are those objects that take up so much  memory?
For
Post by Wilson, Phil
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at
or
Post by Wilson, Phil
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them
running.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Wilson, Phil
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Marc Brooks
2009-08-06 19:46:53 UTC
Permalink
Now that you've got the memory creep happening, take a crash dump and
see what's on the various heaps:

Tess gives the best rundown
http://blogs.msdn.com/tess/archive/2008/02/15/net-debugging-demos-lab-3-memory.aspx

Also useful:

http://msdn.microsoft.com/en-us/magazine/cc163528.aspx
http://www.eggheadcafe.com/articles/20060114.asp
http://www.dumpanalysis.org/blog/index.php/2007/08/19/crash-dump-analysis-patterns-part-20b/

Things are tons easier with SOSEX v2

http://www.stevestechspot.com/SOSEXV2NowAvailable.aspx
Post by Eddie Lascu
Hi Folks,
So I have been running this Red Gate Memory Profiler for more than 8 days
now and I can see some very interesting developments. The Profiler is
monitoring some of the Performance Counters. One in particular has caught my
interest and that is the size of Private Bytes. Although steady for the
first two days at 48 MB, after that it started to grow slowly and what was a
flat line before, turned into a ascending incline ramp. At the moment I type
this message, the size of the Private Bytes is 855 MB. In the task manager,
my process is indicated as having the Virtual Memory size up to 876 MB while
the Mem Usage is only 64 MB.
I believe this clearly indicates that there is no memory leak per se, but
rather is just that the large objects heap is growing w/o control.
Is my assessment correct?
Regards,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Thursday, July 30, 2009 2:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi,
Yes, ADPlus is really just a complex VB script that drive windb(a)g.  If you
feed it the -? option, it should spew out a lot of helpful info on the
various ways you can use it.
I wrote a blog post on our team blog not too long ago regarding ADPlus that
http://blogs.msdn.com/ntdebugging/archive/2009/05/18/capturing-adplus-clr-cr
ashes.aspx
I hope this helps,
       -Trey
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Thursday, July 30, 2009 1:04 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Thank you, Guys. I will look into that as well. Do I need a special start of
the process if I am to use ADPlus or I can attach to the process later?
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Thursday, July 30, 2009 1:52 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Yep exactly what ADPlus is meant for! you can even do this right
within ADPlus :)
On Thu, Jul 30, 2009 at 1:49 PM, Wilson,
Post by Wilson, Phil
Not answering this particular question, but I believe you could hook
all
this together to automatically get that dump when the memory gets large if
it's rare enough that you don't want to sit and look at it all day. Perfmon
has triggers that can fire off a script, and you can fire off the debugging
script ADPlus to dump your process with the -hang option.
Post by Wilson, Phil
Phil Wilson
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Wednesday, July 29, 2009 11:40 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Based on my preliminary reading of what this has to offer, it seems
you
can
Post by Wilson, Phil
integrate it with your VS IDE (not an option for me as my processes
are
Post by Wilson, Phil
already deployed) or use it via WinDbg, but you need to look at the
debug
Post by Wilson, Phil
version or the runtime version that has the .pdb file (not an option
either
Post by Wilson, Phil
as I only have the sole runtime file deployed, but much easily
fixable).
Is
Post by Wilson, Phil
this statement accurate?
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Tuliper
Post by Wilson, Phil
Sent: Wednesday, July 29, 2009 1:24 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
http://blogs.msdn.com/alejacma/archive/2009/06/30/sos-cheat-sheet-net-
2-0-3-
Post by Wilson, Phil
0-3-5.aspx
!DumpHeap -min 85000
!EEHeap -GC; !DumpHeap <LOH begin> <LOH allocated>
   -> Shows all objects in Large Object Heap (LOH/Gen 3).
Post by Greg Young
Yes with ants you have to wait for the problem to happen.
if you google SOS you can find some tutorials on it (it is a
separate
Post by Wilson, Phil
Post by Greg Young
download from windbg ... it can also be used in visual studio!).
John
Post by Wilson, Phil
Post by Greg Young
Robbins also has a great book covering the subject that I highly
recommend.
Cheers,
greg
Post by Eddie Lascu
Shoot, I didn't know SOS can do that for you. Can you share more
about
Post by Wilson, Phil
Post by Greg Young
this
Post by Eddie Lascu
tool (a link to download it)? Is it part of the WinDbg tool that
comes
Post by Wilson, Phil
Post by Greg Young
from
Post by Eddie Lascu
Microsoft? It's true that with ANTS I am at the mercy of the
system,
Post by Wilson, Phil
Post by Greg Young
hoping
Post by Eddie Lascu
it will go nuts again and will have the memory size shut up crazy
high.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:46 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
The wonderful thing about SOS is you dont need to run a profiler
...
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
when it happens take a memory dump, look whats actually happening
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
the running app, is your LOH fragmented? Otherwise you are just
sticking your thumb up your butt and saying it will rain next
thursday.
Post by Eddie Lascu
I am using Reg Gate ANTS to profile the app, but it may take too
much
Post by Wilson, Phil
to
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
happen again. Before the spike I saw last weekend, the processes
ran
Post by Wilson, Phil
for
Post by Greg Young
Post by Eddie Lascu
3-4
Post by Eddie Lascu
months with no significant change in the size of memory used.
Will look into Process.WorkingSet.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Young
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Wednesday, July 29, 2009 12:38 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Task manager shows you working set not total memory used but yes
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
process class can help you with that (Process.WorkingSet as an
example).
Have you verified the LOH being the problem by using SOS?
Cheers,
Greg
On Wed, Jul 29, 2009 at 12:33 PM, Eddie
Post by Eddie Lascu
Hi guys,
http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-
large-ob
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
ject-heap/
Post by Eddie Lascu
I am no longer sure what I have is a memory leak. I could see
how
some
Post by Wilson, Phil
Post by Greg Young
of
Post by Eddie Lascu
Post by Eddie Lascu
the things that happen in my application match the scenarios
described
Post by Wilson, Phil
Post by Greg Young
in
Post by Eddie Lascu
Post by Eddie Lascu
the above article. Hence, I am ready to think about a workaround.
My
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
services are set up to run automatically and restart in case they
crash.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
While they never crash, I could leverage that feature and use it
to
fix
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
this
Post by Eddie Lascu
excess memory usage that I experience every once in a blue moon.
What
I
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
thought was to monitor the memory used and terminate the
application
in
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
case
Post by Eddie Lascu
it exceeds a set threshold. The Windows Service Manager will then
restart
Post by Eddie Lascu
Post by Eddie Lascu
the service and all the memory will be reclaimed by the OS.
Post by Eddie Lascu
My question at this point is whether the .NET Framework has some
metric
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
classes that can help monitor the total amount of memory
allocated
Post by Wilson, Phil
Post by Greg Young
within
Post by Eddie Lascu
a
Post by Eddie Lascu
process. Surely System.Diagnostics must have something like that.
Is
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
anyone
Post by Eddie Lascu
aware of a way to find out what memory is used by a process, just
like
Post by Wilson, Phil
Post by Greg Young
the
Post by Eddie Lascu
Post by Eddie Lascu
Task Manager does?
Post by Eddie Lascu
Cheers,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Wildermuth
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:49 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Also, your 'using' statement stuff should help, but are you sure
that
Post by Wilson, Phil
Post by Greg Young
all
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
your object (XML classes and db connection classes) that support
IDisposable
Post by Eddie Lascu
are being cleaned up?
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Warner
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Sent: Monday, July 27, 2009 12:28 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I don't disagree with you just note that before 'some change'
working
Post by Wilson, Phil
Post by Greg Young
OK
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
no memory leaks, after change, memory leak. We both know your
code
did
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
not
Post by Eddie Lascu
Post by Eddie Lascu
recompile itself to include a memory leak ...
That reminds has the framework/runtimes been updated/patched?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 12:00 PM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi John,
I could check that with our system administrators. Do you think
that
Post by Wilson, Phil
Post by Greg Young
can
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
be
a possible explanation?
I just talked with one of the DB Admin and she said she made
some
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
changes
on
some Stored Produces, but nothing as dramatic as a patch
update. She
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
also
said that the drivers for the network cards were updated last
week,
Post by Wilson, Phil
Post by Greg Young
but
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
can't see how that can affect the memory used by my processes.
Thanks,
Eddie
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process
Not what you are seeking, but has anything on the server
changed? An
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle patch or something of that nature?
John Warner
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a
process
Hi guys,
I need your help with an issue I am having right now. I have
several
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
windows
services deployed. These services gather some XML files from
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
internet
and then parse the content and save the information in the
database.
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
The
database is Oracle 11g, so the access is done through
ODP.NET. I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
some
issues before (and some of you with good memory may recall my
previous
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
questions) where I noticed the memory used by these services
growing
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
very
high. At the time, I understood that some classes in the
ODP.NET
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
library
use
some JAVA code and they are known for not cleaning properly
after
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
them.
As a
result I rewrote my code in such a way that every dynamic
allocation
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
of
an
object from the ODP.NET library was encompassed in an "using"
statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a
constant
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
size
when
it came to the total memory used, a size that hovered around
55-60
Post by Wilson, Phil
Post by Greg Young
MB.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
This
was the case for months. At the beginning I checked the size
almost
Post by Wilson, Phil
Post by Greg Young
on
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
a
daily basis. After a while, my confidence grew and I only
checked
Post by Wilson, Phil
it
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
once a
week or so. Every time I looked at the size of all my
processes (I
Post by Wilson, Phil
Post by Greg Young
had
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
4
that followed pretty much the same approach on dealing with
those
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of
the
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
services
shut up to about 690 MB, despite the fact the service was
running
Post by Wilson, Phil
Post by Greg Young
with
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
the
exact same code as it did a month ago. This represents a
potential
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
fatal
problem for the server that can get to a point where it can
no
Post by Wilson, Phil
Post by Greg Young
longer
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
allocate memory, so I need to find a way to understand what
the
Post by Wilson, Phil
heck
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
is
going on. Unfortunately, I do not have any metrics
implemented in
Post by Wilson, Phil
my
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
application to log the total amount of memory used. That
would
have
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
been
a
very good indication on when exactly did this surge started
to
Post by Wilson, Phil
Post by Greg Young
happen.
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
I
could have checked the Event Viewer to see if the server got
hit
by
Post by Wilson, Phil
Post by Greg Young
a
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
nuclear bomb or something on that precise moment. I really
don't
Post by Wilson, Phil
get
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
this. I
mean that's why we moved to .NET in the first place, to be
rid of
Post by Wilson, Phil
Post by Greg Young
such
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
concerns, like making sure all dynamically allocated objects
are
Post by Wilson, Phil
Post by Greg Young
then
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
destroyed.
Can anyone give me an idea on how to investigate this issue?
Are
Post by Wilson, Phil
Post by Greg Young
there
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
tools
out there that could be used to pick at the memory allocated
by a
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
process
and see what are those objects that take up so much  memory?
For
Post by Wilson, Phil
the
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
time
being, I have the processes running, but two of them are at
or
Post by Wilson, Phil
close
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
to
690
MB and I don't know how long will I be able to keep them
running.
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
Post by Eddie Lascu
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Eddie Lascu
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
Post by Eddie Lascu
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour
m'assurer
Post by Wilson, Phil
Post by Greg Young
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
Post by Wilson, Phil
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Marc C. Brooks
http://musingmarc.blogspot.com

NOT sent from an iPhone

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Marc Brooks
2009-08-06 19:54:45 UTC
Permalink
On another note, there's a way to do the memory walks without taking a dump

http://blogs.msdn.com/tess/archive/2009/05/08/neat-net-2-0-stackviewer-to-troubleshoot-hangs-performance-issues.aspx

Also, a ready-made script for analyzing a dump if you have one

http://blogs.msdn.com/tess/archive/2009/05/12/debug-diag-script-for-troubleshooting-net-2-0-memory-leaks.aspx

In short, read Tess' blog :)

Marc

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-08-06 20:35:06 UTC
Permalink
I am a bit challenged when it comes to use these tools (WinDbg & SOSEX). I have started to Red Gate Memory Profiler and had hoped that it will give me enough details. I will read and try to figure out how to use WinDbg. I have downloaded the latest version and installed it on the server where this process grows. I need to figure out how to incorporate sosex.dll (which I also downloaded) and then learn how to take the memory dump and analyze it. Someone said this is not for the faint of heart. I think I understand that now so bear with me, please.

Thanks,
Eddie


-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Marc Brooks
Sent: Thursday, August 06, 2009 3:55 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

On another note, there's a way to do the memory walks without taking a dump

http://blogs.msdn.com/tess/archive/2009/05/08/neat-net-2-0-stackviewer-to-troubleshoot-hangs-performance-issues.aspx

Also, a ready-made script for analyzing a dump if you have one

http://blogs.msdn.com/tess/archive/2009/05/12/debug-diag-script-for-troubleshooting-net-2-0-memory-leaks.aspx

In short, read Tess' blog :)

Marc

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Shawn Wildermuth
2009-07-27 16:47:50 UTC
Permalink
Memory profiler should be your friend here...either VS's or something more
industrial like Red Gate's ANT.

Thanks,

Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker

The Silverlight Tour is coming to a city near you!

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Eddie Lascu
Sent: Monday, July 27, 2009 11:33 AM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a process

Hi guys,



I need your help with an issue I am having right now. I have several windows
services deployed. These services gather some XML files from the internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing very
high. At the time, I understood that some classes in the ODP.NET library use
some JAVA code and they are known for not cleaning properly after them. As a
result I rewrote my code in such a way that every dynamic allocation of an
object from the ODP.NET library was encompassed in an "using" statement,
like this:



using (OracleCommand objDbCommand = new OracleCommand(strSqlSelectStatement,
objConnection))



All was fine for a very long time. All my services kept a constant size when
it came to the total memory used, a size that hovered around 55-60 MB. This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.



Now, all of a sudden, this last weekend, the size for some of the services
shut up to about 690 MB, despite the fact the service was running with the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have been a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.



Can anyone give me an idea on how to investigate this issue? Are there tools
out there that could be used to pick at the memory allocated by a process
and see what are those objects that take up so much memory? For the time
being, I have the processes running, but two of them are at or close to 690
MB and I don't know how long will I be able to keep them running.



If you had an issue like this, what would you try to do?



Any suggestion will be greatly appreciated.



TIA,

Eddie




===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Greg Young
2009-07-27 16:43:43 UTC
Permalink
Try SOS there is plenty of documentation out there on how to take a
memory dump of your application.

Get in and look at what if any objects are currently on your heaps.

Cheers,

Greg

On Mon, Jul 27, 2009 at 12:47 PM, Shawn
Post by Shawn Wildermuth
Memory profiler should be your friend here...either VS's or something more
industrial like Red Gate's ANT.
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi guys,
I need your help with an issue I am having right now. I have several windows
services deployed. These services gather some XML files from the internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing very
high. At the time, I understood that some classes in the ODP.NET library use
some JAVA code and they are known for not cleaning properly after them. As a
result I rewrote my code in such a way that every dynamic allocation of an
object from the ODP.NET library was encompassed in an "using" statement,
using (OracleCommand objDbCommand = new OracleCommand(strSqlSelectStatement,
objConnection))
All was fine for a very long time. All my services kept a constant size when
it came to the total memory used, a size that hovered around 55-60 MB. This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the services
shut up to about 690 MB, despite the fact the service was running with the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have been a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there tools
out there that could be used to pick at the memory allocated by a process
and see what are those objects that take up so much  memory? For the time
being, I have the processes running, but two of them are at or close to 690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-27 17:12:31 UTC
Permalink
Thanks,

I installed WinDbg and will play with it.

Cheers,
Eddie


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Greg Young
Sent: Monday, July 27, 2009 12:44 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Try SOS there is plenty of documentation out there on how to take a
memory dump of your application.

Get in and look at what if any objects are currently on your heaps.

Cheers,

Greg

On Mon, Jul 27, 2009 at 12:47 PM, Shawn
Post by Shawn Wildermuth
Memory profiler should be your friend here...either VS's or something more
industrial like Red Gate's ANT.
Thanks,
Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of advanced .NET topics.
Sent: Monday, July 27, 2009 11:33 AM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a process
Hi guys,
I need your help with an issue I am having right now. I have several windows
services deployed. These services gather some XML files from the internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing very
high. At the time, I understood that some classes in the ODP.NET library use
some JAVA code and they are known for not cleaning properly after them. As a
result I rewrote my code in such a way that every dynamic allocation of an
object from the ODP.NET library was encompassed in an "using" statement,
using (OracleCommand objDbCommand = new
OracleCommand(strSqlSelectStatement,
Post by Shawn Wildermuth
objConnection))
All was fine for a very long time. All my services kept a constant size when
it came to the total memory used, a size that hovered around 55-60 MB. This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.
Now, all of a sudden, this last weekend, the size for some of the services
shut up to about 690 MB, despite the fact the service was running with the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have been a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.
Can anyone give me an idea on how to investigate this issue? Are there tools
out there that could be used to pick at the memory allocated by a process
and see what are those objects that take up so much  memory? For the time
being, I have the processes running, but two of them are at or close to 690
MB and I don't know how long will I be able to keep them running.
If you had an issue like this, what would you try to do?
Any suggestion will be greatly appreciated.
TIA,
Eddie
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives
--
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer
de votre attention

===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Eddie Lascu
2009-07-27 16:49:39 UTC
Permalink
Shawn,

I did install ANTS on the server. The problem, as I see it, is that I will have to restart the services and that surely will bring down the amount of memory used. Will it grow back to where it is? I don't know. It may not. I have been keeping an eye on these processes for months and they were constant in terms of memory used. Then they exploded in the last couple of days.

Do you know if there is a tool that can be attached to a running process and take a snapshot of the memory that's allocated? It would be interesting to see that the memory is used 100 strings, 200 integers and ten billion instances of MyClassThatIsNotProperlyCleaned. That way I would know where to look.

At this time we plan to run the processes and have them profiled by ANTS but I am afraid it will not give me the real cause of the problem.

Thanks for your reply and suggestions.

Regards,
Eddie



-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Shawn Wildermuth
Sent: Monday, July 27, 2009 12:48 PM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: Re: [ADVANCED-DOTNET] Excess memory usage growth for a process

Memory profiler should be your friend here...either VS's or something more
industrial like Red Gate's ANT.

Thanks,

Shawn Wildermuth
http://wildermuth.com
https://agilitrain.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker

The Silverlight Tour is coming to a city near you!

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:ADVANCED-***@PEACH.EASE.LSOFT.COM] On Behalf Of Eddie Lascu
Sent: Monday, July 27, 2009 11:33 AM
To: ADVANCED-***@PEACH.EASE.LSOFT.COM
Subject: [ADVANCED-DOTNET] Excess memory usage growth for a process

Hi guys,



I need your help with an issue I am having right now. I have several windows
services deployed. These services gather some XML files from the internet
and then parse the content and save the information in the database. The
database is Oracle 11g, so the access is done through ODP.NET. I had some
issues before (and some of you with good memory may recall my previous
questions) where I noticed the memory used by these services growing very
high. At the time, I understood that some classes in the ODP.NET library use
some JAVA code and they are known for not cleaning properly after them. As a
result I rewrote my code in such a way that every dynamic allocation of an
object from the ODP.NET library was encompassed in an "using" statement,
like this:



using (OracleCommand objDbCommand = new OracleCommand(strSqlSelectStatement,
objConnection))



All was fine for a very long time. All my services kept a constant size when
it came to the total memory used, a size that hovered around 55-60 MB. This
was the case for months. At the beginning I checked the size almost on a
daily basis. After a while, my confidence grew and I only checked it once a
week or so. Every time I looked at the size of all my processes (I had 4
that followed pretty much the same approach on dealing with those Oracle
objects) the size was around that 55-60 MB mark.



Now, all of a sudden, this last weekend, the size for some of the services
shut up to about 690 MB, despite the fact the service was running with the
exact same code as it did a month ago. This represents a potential fatal
problem for the server that can get to a point where it can no longer
allocate memory, so I need to find a way to understand what the heck is
going on. Unfortunately, I do not have any metrics implemented in my
application to log the total amount of memory used. That would have been a
very good indication on when exactly did this surge started to happen. I
could have checked the Event Viewer to see if the server got hit by a
nuclear bomb or something on that precise moment. I really don't get this. I
mean that's why we moved to .NET in the first place, to be rid of such
concerns, like making sure all dynamically allocated objects are then
destroyed.



Can anyone give me an idea on how to investigate this issue? Are there tools
out there that could be used to pick at the memory allocated by a process
and see what are those objects that take up so much memory? For the time
being, I have the processes running, but two of them are at or close to 690
MB and I don't know how long will I be able to keep them running.



If you had an issue like this, what would you try to do?



Any suggestion will be greatly appreciated.



TIA,

Eddie




===================================
View archives and manage your subscription(s) at
http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
Loading...