Garbage Collection - Windows 2000 Server vs. Windows 2003 Server - DOTNET
This is a discussion on Garbage Collection - Windows 2000 Server vs. Windows 2003 Server - DOTNET ; Hello All.
We have an application (a set of services) that runs credit applications
through a series of workflow steps to determine if credit should be extended
or not. Each "step" is a separate instance of a class, and many ...
-
Garbage Collection - Windows 2000 Server vs. Windows 2003 Server
Hello All.
We have an application (a set of services) that runs credit applications
through a series of workflow steps to determine if credit should be extended
or not. Each "step" is a separate instance of a class, and many of these
steps access an Oracle database and MSMQ.
When I process 20 thousand applications on Windows 2003, the service never
uses more than 70 mb of memory, but when running on Windows 2000 Server, it
uses an astonishing 1.4 GB of memory. This memory never seems to be
reclaimed unless the process is restarted, or I have noticed if I wait
several hours, some of it (about half) is eventually reclaimed. I have used
several profiling tools, and most of the memory seems to be consumed by
database related things, like Connections, Parameters, Commands, Readers,
etc.
I have gone over the code with a fine tooth comb, and we are Close() ing and
Dispose() ing everything I can find. It's true we create and destroy many of
these class instances during a large run, but does anyone have an idea as to
why the memory footprint is so large and unreclaimed on Windows 2000 vs
Windows 2003? Is there some difference in the garbage collection? Both boxes
are identical hardware. Dual Processor P4 machines, with the same amount of
memory.
We are running the .NET framework V1.1 with SP1 on both machines. The
application is straight C# managed code. It uses MSMQ and Oracle as external
support services. I am at a loss. Any help appreciated.
Thanks,
Robert Reineri
Sr. Business Systems Engineer
First National Bank of Marin
P.S. Please respond via news group if possible. I get spammed so much when I
include my email address, I've stopped including it in my posts.
-
Re: Garbage Collection - Windows 2000 Server vs. Windows 2003 Server
Robert Reineri wrote:
> Hello All.
>
> We have an application (a set of services) that runs credit applications
<snip>
The first question you should ask and answer is "Does the seemingly
extreme memory use pose a problem for the machine or other programs?".
Too many times I see people get caught up in how .NET seemingly uses an
extreme amount of memory without realizing how GC really works.
GC will only collect when necessary. This means that if your server have
more than enough memory, it might simply postpone the whole collection
until later. Think of it as trying to fill your entire garage with
garbage before doing any cleaning at all, vs. throwing away every little
bit of garbage as soon as it appears.
If, on the other hand, you use more memory than you got (ie. a lot of
disk-thrashing is happening) or you starve other programs (or even the
same service) for memory, you might have a problem.
As an example, try running a simple winforms application on a machine
which got lots of memory available vs. one that has very little
available. On the machine that has little available, the winforms
application will use less memory and possibly use a bit longer to start
because it has to do garbage collection one or more times during this,
while on the machine with a lot of memory the application might use more
memory and not do any garbage collections at all.
Now, if you know it is a genuine problem, please disregard this whole
post 
Now, this isn't to say that you shouldn't try to figure out what it is,
because for a brief period of time, that memory is unavailable to other
processes on that machine, but if the memory use doesn't pose a problem
I would just let it be.
As an experiment, when it has allocated those 1.4 GB of memory, try
loading up several other programs that use a lot of memory (even write
one that simply allocates a big array or something if you have to) and
see if the memory used by your service drops to a more manageable level.
If it does then it's probably just GC that kicked in to get rid of the
unnecessary memory.
You could also try to trigger a GC.Collect() in your code although I
would only do that as an experiment. As I said above, if your machine
runs fine other than this seemingly huge memory use, I would just leave it.
--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
mailto:lasse@vkarlsen.no
PGP KeyID: 0x2A42A1C2
-
Re: Garbage Collection - Windows 2000 Server vs. Windows 2003 Server
Just as a sanity check, see if someone has set the COMPLUS_BUILDFLAVOR
environment variable to SVR on the Windows 2000 box. It's not supported
officially but maybe someone has been experimenting. The server GC uses more
memory than the workstation one.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
"Robert Reineri" <SORRYSPAMMER@NOJUNK.COM> wrote in message
news:%23M7Nji%23rFHA.1684@TK2MSFTNGP14.phx.gbl...
> Hello All.
>
> We have an application (a set of services) that runs credit applications
> through a series of workflow steps to determine if credit should be
> extended or not. Each "step" is a separate instance of a class, and many
> of these steps access an Oracle database and MSMQ.
>
> When I process 20 thousand applications on Windows 2003, the service never
> uses more than 70 mb of memory, but when running on Windows 2000 Server,
> it uses an astonishing 1.4 GB of memory. This memory never seems to be
> reclaimed unless the process is restarted, or I have noticed if I wait
> several hours, some of it (about half) is eventually reclaimed. I have
> used several profiling tools, and most of the memory seems to be consumed
> by database related things, like Connections, Parameters, Commands,
> Readers, etc.
>
> I have gone over the code with a fine tooth comb, and we are Close() ing
> and Dispose() ing everything I can find. It's true we create and destroy
> many of these class instances during a large run, but does anyone have an
> idea as to why the memory footprint is so large and unreclaimed on Windows
> 2000 vs Windows 2003? Is there some difference in the garbage collection?
> Both boxes are identical hardware. Dual Processor P4 machines, with the
> same amount of memory.
>
> We are running the .NET framework V1.1 with SP1 on both machines. The
> application is straight C# managed code. It uses MSMQ and Oracle as
> external support services. I am at a loss. Any help appreciated.
>
> Thanks,
>
> Robert Reineri
> Sr. Business Systems Engineer
> First National Bank of Marin
>
> P.S. Please respond via news group if possible. I get spammed so much when
> I include my email address, I've stopped including it in my posts.
>
-
Re: Garbage Collection - Windows 2000 Server vs. Windows 2003 Server
Thanks for the reply Phil. I checked, and there is no such environment
variable defined. Appreciate the thought.
Robert
"Phil Wilson" <pdjwilson@nospam.cox.net> wrote in message
news:%2365YK0jsFHA.760@TK2MSFTNGP14.phx.gbl...
> Just as a sanity check, see if someone has set the COMPLUS_BUILDFLAVOR
> environment variable to SVR on the Windows 2000 box. It's not supported
> officially but maybe someone has been experimenting. The server GC uses
> more memory than the workstation one.
> --
> Phil Wilson
> [Microsoft MVP-Windows Installer]
> "Robert Reineri" <SORRYSPAMMER@NOJUNK.COM> wrote in message
> news:%23M7Nji%23rFHA.1684@TK2MSFTNGP14.phx.gbl...
>> Hello All.
>>
>> We have an application (a set of services) that runs credit applications
>> through a series of workflow steps to determine if credit should be
>> extended or not. Each "step" is a separate instance of a class, and many
>> of these steps access an Oracle database and MSMQ.
>>
>> When I process 20 thousand applications on Windows 2003, the service
>> never uses more than 70 mb of memory, but when running on Windows 2000
>> Server, it uses an astonishing 1.4 GB of memory. This memory never seems
>> to be reclaimed unless the process is restarted, or I have noticed if I
>> wait several hours, some of it (about half) is eventually reclaimed. I
>> have used several profiling tools, and most of the memory seems to be
>> consumed by database related things, like Connections, Parameters,
>> Commands, Readers, etc.
>>
>> I have gone over the code with a fine tooth comb, and we are Close() ing
>> and Dispose() ing everything I can find. It's true we create and destroy
>> many of these class instances during a large run, but does anyone have an
>> idea as to why the memory footprint is so large and unreclaimed on
>> Windows 2000 vs Windows 2003? Is there some difference in the garbage
>> collection? Both boxes are identical hardware. Dual Processor P4
>> machines, with the same amount of memory.
>>
>> We are running the .NET framework V1.1 with SP1 on both machines. The
>> application is straight C# managed code. It uses MSMQ and Oracle as
>> external support services. I am at a loss. Any help appreciated.
>>
>> Thanks,
>>
>> Robert Reineri
>> Sr. Business Systems Engineer
>> First National Bank of Marin
>>
>> P.S. Please respond via news group if possible. I get spammed so much
>> when I include my email address, I've stopped including it in my posts.
>>
>
>
Similar Threads
-
By Application Development in forum Javascript
Replies: 4
Last Post: 08-21-2007, 10:49 PM
-
By Application Development in forum Inetserver
Replies: 4
Last Post: 06-26-2007, 04:16 PM
-
By Application Development in forum Inetserver
Replies: 0
Last Post: 12-09-2005, 11:07 AM
-
By Application Development in forum Microsoft Exchange
Replies: 1
Last Post: 03-19-2005, 02:52 PM
-
By Application Development in forum DOTNET
Replies: 0
Last Post: 12-01-2004, 07:01 PM