473,322 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

High memory usage

How come .Net applications use so much memory? Every application I compile
uses at least 10 MB of memory, even the ones consisting of only a form and
nothing else. If I minimize them though the memory usage drops to a couple
hundred KB. Why?

Is there anything I should to to prevent this? I have compiled in release
and deactivated all forms of debugging, I think!

Thanks,
Philip
Nov 15 '05 #1
20 4179
Philip,

You could reduce the working set down to zero using API calls, but it
will just creep back up. The reason why the memory is consumed is because
the runtime is using the memory for garbage collection.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
How come .Net applications use so much memory? Every application I compile
uses at least 10 MB of memory, even the ones consisting of only a form and
nothing else. If I minimize them though the memory usage drops to a couple
hundred KB. Why?

Is there anything I should to to prevent this? I have compiled in release
and deactivated all forms of debugging, I think!

Thanks,
Philip

Nov 15 '05 #2
Hi,

Nicholas Paldino [.NET/C# MVP] wrote:
You could reduce the working set down to zero using API calls,
but it will just creep back up. The reason why the memory is
consumed is because the runtime is using the memory for garbage
collection.


..NET is quite greedy with memory.. but it does play fair. When you have lots
of memory available it will allocate lots, when there is very little it will
release what it doesn't need (like when you minimise the app).

There's a demo in one of the TechEd 2003 speeches available online (I forget
the address).

-- Pete
Nov 15 '05 #3
See inline ****

"Pete" <pv*****@gawab.com> wrote in message news:pG*****************@newsfep2-gui.server.ntli.net...
.NET is quite greedy with memory.. but it does play fair. When you have lots
of memory available it will allocate lots, when there is very little it will
release what it doesn't need (like when you minimise the app).

**** Too much honor for the CLR, actually it's the OS who (tries to) reclaims the memory (trimming the WS) :-).
There's a demo in one of the TechEd 2003 speeches available online (I forget
the address).

-- Pete

Willy.
Nov 15 '05 #4
Is'nt there any way of solving this?
Non DotNet applications are able to run on very low memory usage... There
must be a way to lower the memory "costs" of running a DotNet application.

The whole DotNet idea is ridiculous otherwise... Can I only have 10 home
made DotNet applications active at once on a 128 MB Ram machine before the
machine completely runs out of memory?
Sounds mighty strange to me...

Thankful for any answers I can get!

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:Oq**************@TK2MSFTNGP11.phx.gbl...
Philip,

You could reduce the working set down to zero using API calls, but it
will just creep back up. The reason why the memory is consumed is because
the runtime is using the memory for garbage collection.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the memory usage drops to a couple hundred KB. Why?

Is there anything I should to to prevent this? I have compiled in release and deactivated all forms of debugging, I think!

Thanks,
Philip


Nov 15 '05 #5
I was under the impression that the working set was the physical memory
usage of the application...

When you minimise the application, dosnt that kick on the OS to page the
memory to harddisk..

I did a test sometime back.. I created a huge array and filled it with
random garbage. Then told it to wait for a key press. I minimised the page
and opened it up again and checked its memory usage. The memory usage by
the app was not enough to hold the array of garbage i stored in the array.
Then i pressed a key and the memory usage jumped up while it was outputting
the garbage back to the screeen. This to me indicates that when i minimised
it, the app had written it to disk reducing the working set. When i started
it back up again, the data was retrieved from disk and output to screen...

Cheers
HappyH

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:uV**************@TK2MSFTNGP10.phx.gbl...
Is'nt there any way of solving this?
Non DotNet applications are able to run on very low memory usage... There
must be a way to lower the memory "costs" of running a DotNet application.

The whole DotNet idea is ridiculous otherwise... Can I only have 10 home
made DotNet applications active at once on a 128 MB Ram machine before the
machine completely runs out of memory?
Sounds mighty strange to me...

Thankful for any answers I can get!

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:Oq**************@TK2MSFTNGP11.phx.gbl...
Philip,

You could reduce the working set down to zero using API calls, but it
will just creep back up. The reason why the memory is consumed is because the runtime is using the memory for garbage collection.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
How come .Net applications use so much memory? Every application I

compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the memory usage drops to a couple hundred KB. Why?

Is there anything I should to to prevent this? I have compiled in release and deactivated all forms of debugging, I think!

Thanks,
Philip



Nov 15 '05 #6
That's all great, but what about other apps while I have the DotNet app up?
I find it very, very strange that an application consisting of nothing but
an empty form would use 10 MB of memory...
Take for example Solitaire, it uses 3 MB of memory while viewed, it simply
can't be that DotNet applications would use 3x more memory than that even
though they do not do anything... If so, DotNet applications are worthless
on all but computers with memory availibility beyond 512MB.
"happyH" <happyh@no_thanks.org> wrote in message
news:Wf******************@news02.tsnz.net...
I was under the impression that the working set was the physical memory
usage of the application...

When you minimise the application, dosnt that kick on the OS to page the
memory to harddisk..

I did a test sometime back.. I created a huge array and filled it with
random garbage. Then told it to wait for a key press. I minimised the page and opened it up again and checked its memory usage. The memory usage by
the app was not enough to hold the array of garbage i stored in the array.
Then i pressed a key and the memory usage jumped up while it was outputting the garbage back to the screeen. This to me indicates that when i minimised it, the app had written it to disk reducing the working set. When i started it back up again, the data was retrieved from disk and output to screen...

Cheers
HappyH

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:uV**************@TK2MSFTNGP10.phx.gbl...
Is'nt there any way of solving this?
Non DotNet applications are able to run on very low memory usage... There
must be a way to lower the memory "costs" of running a DotNet application.
The whole DotNet idea is ridiculous otherwise... Can I only have 10 home
made DotNet applications active at once on a 128 MB Ram machine before the machine completely runs out of memory?
Sounds mighty strange to me...

Thankful for any answers I can get!

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com>

wrote
in message news:Oq**************@TK2MSFTNGP11.phx.gbl...
Philip,

You could reduce the working set down to zero using API calls, but it will just creep back up. The reason why the memory is consumed is because the runtime is using the memory for garbage collection.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
> How come .Net applications use so much memory? Every application I

compile
> uses at least 10 MB of memory, even the ones consisting of only a

form and
> nothing else. If I minimize them though the memory usage drops to a

couple
> hundred KB. Why?
>
> Is there anything I should to to prevent this? I have compiled in

release
> and deactivated all forms of debugging, I think!
>
> Thanks,
> Philip
>
>



Nov 15 '05 #7
Hi,

Philip Carnstam wrote:
The whole DotNet idea is ridiculous otherwise... Can I only have 10
home made DotNet applications active at once on a 128 MB Ram machine
before the machine completely runs out of memory?
Sounds mighty strange to me...


There are two things to consider here:

1) In low memory conditions your application will use less memory (try
opening many high memory usage applications and see for yourself). You get a
similar effect when you application is minimised and restored.

2) Most of that memory usage is the framework itself.. which *should* be
shared between applications running at the same time (someone correct me if
I'm wrong with this). If I'm right on this, having many .NET apps open at
once should take less memory than having many (similar) non-.net apps open.

Basically ignore what the task manager is telling you and just write your
program.

-- Pete
Nov 15 '05 #8
Each program has to load the CLR runtime, the Jitter, the C runtime library and some Win32 libraries, most of these are SHARED
libraries. The CLR also reserves memory for the GC heap
Your minimal application also has to load mscorlib and the windows.forms package.
90% of this 10 MB has been taken by these libs. So a much larger application will not take much more memory unless you are creating
a lot of (or large) objects.

Willy.

"Philip Carnstam" <ph*************@carnstam.net> wrote in message news:O0**************@TK2MSFTNGP09.phx.gbl...
That's all great, but what about other apps while I have the DotNet app up?
I find it very, very strange that an application consisting of nothing but
an empty form would use 10 MB of memory...
Take for example Solitaire, it uses 3 MB of memory while viewed, it simply
can't be that DotNet applications would use 3x more memory than that even
though they do not do anything... If so, DotNet applications are worthless
on all but computers with memory availibility beyond 512MB.
"happyH" <happyh@no_thanks.org> wrote in message
news:Wf******************@news02.tsnz.net...
I was under the impression that the working set was the physical memory
usage of the application...

When you minimise the application, dosnt that kick on the OS to page the
memory to harddisk..

I did a test sometime back.. I created a huge array and filled it with
random garbage. Then told it to wait for a key press. I minimised the

page
and opened it up again and checked its memory usage. The memory usage by
the app was not enough to hold the array of garbage i stored in the array.
Then i pressed a key and the memory usage jumped up while it was

outputting
the garbage back to the screeen. This to me indicates that when i

minimised
it, the app had written it to disk reducing the working set. When i

started
it back up again, the data was retrieved from disk and output to screen...

Cheers
HappyH

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:uV**************@TK2MSFTNGP10.phx.gbl...
Is'nt there any way of solving this?
Non DotNet applications are able to run on very low memory usage... There must be a way to lower the memory "costs" of running a DotNet application.
The whole DotNet idea is ridiculous otherwise... Can I only have 10 home
made DotNet applications active at once on a 128 MB Ram machine before the machine completely runs out of memory?
Sounds mighty strange to me...

Thankful for any answers I can get!

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com>

wrote
in message news:Oq**************@TK2MSFTNGP11.phx.gbl...
> Philip,
>
> You could reduce the working set down to zero using API calls, but

it
> will just creep back up. The reason why the memory is consumed is

because
> the runtime is using the memory for garbage collection.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - ni**************@exisconsulting.com
>
> "Philip Carnstam" <ph*************@carnstam.net> wrote in message
> news:%2***************@tk2msftngp13.phx.gbl...
> > How come .Net applications use so much memory? Every application I
compile
> > uses at least 10 MB of memory, even the ones consisting of only a form and
> > nothing else. If I minimize them though the memory usage drops to a
couple
> > hundred KB. Why?
> >
> > Is there anything I should to to prevent this? I have compiled in
release
> > and deactivated all forms of debugging, I think!
> >
> > Thanks,
> > Philip
> >
> >
>
>



Nov 15 '05 #9
Pete,
Philip Carnstam wrote:
The whole DotNet idea is ridiculous otherwise... Can I only have 10
home made DotNet applications active at once on a 128 MB Ram machine
before the machine completely runs out of memory?
Sounds mighty strange to me...

[snip]
Basically ignore what the task manager is telling you and just write your
program.


By-the-way --> The task manager does lie at times about the memory
consumption. It can not be trusted to give the exact information all the
time.

Regards,

Randy
Nov 15 '05 #10
"Philip Carnstam" <ph*************@carnstam.net> wrote in message news:<O0**************@TK2MSFTNGP09.phx.gbl>...
If so, DotNet applications are worthless
on all but computers with memory availibility beyond 512MB.


If you like your apps lean and quick, I doubt DotNet is
the tool you want to use at this point of its evolution.

look at C, C++, Delphi...

The Next Big Thing isn't the always the right hammer for every nail.
Nov 15 '05 #11
Willy Denoyette [MVP] <wi*************@pandora.be> wrote:
See inline ****

"Pete" <pv*****@gawab.com> wrote:
.NET is quite greedy with memory.. but it does play fair. When
you have lots of memory available it will allocate lots, when
there is very little it will release what it doesn't need (like
when you minimise the app).


**** Too much honor for the CLR, actually it's the OS who
(tries to) reclaims the memory (trimming the WS) :-).


Well, it's not *just* the OS here. The CLR responds to memory
requirements of other apps by garbage collecting appropriately (when it
might not bother if there's plenty of memory available).

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #12
The problem is that DotNet does do alot of the things I want the application
to do easily, for example, being able to use xml documents as data
sources... I only find it strange that the memory usage is so high, but I
guess I'm stuck with that fact...

Thanks for all the response!

"Andrew Walsh" <wa********@hotmail.com> wrote in message
news:52**************************@posting.google.c om...
"Philip Carnstam" <ph*************@carnstam.net> wrote in message

news:<O0**************@TK2MSFTNGP09.phx.gbl>...
If so, DotNet applications are worthless
on all but computers with memory availibility beyond 512MB.


If you like your apps lean and quick, I doubt DotNet is
the tool you want to use at this point of its evolution.

look at C, C++, Delphi...

The Next Big Thing isn't the always the right hammer for every nail.

Nov 15 '05 #13
In addition to what everyone else said, here's an example of just how
many files are loaded into memory. It's a simple little WinForm to
get the MD5 checksum. The files that are loaded are:

c:\winnt\system32\MPR.DLL
c:\winnt\system32\ADVAPI32.DLL
c:\winnt\system32\KERNEL32.DLL
c:\winnt\system32\MSCOREE.DLL
c:\winnt\system32\NTDLL.DLL
c:\winnt\system32\RPCRT4.DLL
c:\winnt\system32\ACTIVEDS.DLL
c:\winnt\system32\ADSLDPC.DLL
c:\winnt\system32\CABINET.DLL
c:\winnt\system32\COMCTL32.DLL
c:\winnt\system32\COMDLG32.DLL
c:\winnt\system32\CRYPT32.DLL
c:\winnt\system32\DBGHELP.DLL
c:\winnt\system32\DNSAPI.DLL
c:\winnt\system32\GDI32.DLL
c:\winnt\system32\IMAGEHLP.DLL
c:\winnt\system32\LZ32.DLL
c:\winnt\system32\MLANG.DLL
c:\winnt\system32\MSASN1.DLL
c:\winnt\system32\MSI.DLL
c:\winnt\system32\MSVCRT.DLL
c:\winnt\system32\NETAPI32.DLL
c:\winnt\system32\NETRAP.DLL
c:\winnt\system32\NTDSAPI.DLL
c:\winnt\system32\OLE32.DLL
c:\winnt\system32\OLEAUT32.DLL
c:\winnt\system32\SAMLIB.DLL
c:\winnt\system32\SECUR32.DLL
c:\winnt\system32\SETUPAPI.DLL
c:\winnt\system32\SFC.DLL
c:\winnt\system32\SFCFILES.DLL
c:\winnt\system32\SHELL32.DLL
c:\winnt\system32\SHLWAPI.DLL
c:\winnt\system32\TAPI32.DLL
c:\winnt\system32\URLMON.DLL
c:\winnt\system32\USER32.DLL
c:\winnt\system32\USERENV.DLL
c:\winnt\system32\VERSION.DLL
c:\winnt\system32\W32TOPL.DLL
c:\winnt\system32\WININET.DLL
c:\winnt\system32\WINMM.DLL
c:\winnt\system32\WINSPOOL.DRV
c:\winnt\system32\WINTRUST.DLL
c:\winnt\system32\WLDAP32.DLL
c:\winnt\system32\WS2_32.DLL
c:\winnt\system32\WS2HELP.DLL
c:\winnt\system32\WSOCK32.DLL

Austin Ehlers

On Fri, 5 Sep 2003 20:26:01 +0200, "Philip Carnstam"
<ph*************@carnstam.net> wrote:
How come .Net applications use so much memory? Every application I compile
uses at least 10 MB of memory, even the ones consisting of only a form and
nothing else. If I minimize them though the memory usage drops to a couple
hundred KB. Why?

Is there anything I should to to prevent this? I have compiled in release
and deactivated all forms of debugging, I think!

Thanks,
Philip


Nov 15 '05 #14

Jon,

While it's possible for the CLR to return virtual memory to the OS (Commited or reserved) by calling VirtualFree I never saw he did
under memory pressure. The only thing I see is that the OS trims the WS by returning unused (unaccessed) pages to swap file when
there is ample memory.
As to your remark "The CLR responds to memory requirements of other apps", how do you think the CLR knows about memory requirements
of other app's?

Willy.

"Jon Skeet" <sk***@pobox.com> wrote in message news:MP************************@news.microsoft.com ...
Willy Denoyette [MVP] <wi*************@pandora.be> wrote:
See inline ****

"Pete" <pv*****@gawab.com> wrote:
.NET is quite greedy with memory.. but it does play fair. When
you have lots of memory available it will allocate lots, when
there is very little it will release what it doesn't need (like
when you minimise the app).


**** Too much honor for the CLR, actually it's the OS who
(tries to) reclaims the memory (trimming the WS) :-).


Well, it's not *just* the OS here. The CLR responds to memory
requirements of other apps by garbage collecting appropriately (when it
might not bother if there's plenty of memory available).

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

Nov 15 '05 #15
See inline ****
Willy.

"Pete" <pv*****@gawab.com> wrote in message news:EC**************@newsfep1-gui.server.ntli.net...
Hi,

Philip Carnstam wrote:
The whole DotNet idea is ridiculous otherwise... Can I only have 10
home made DotNet applications active at once on a 128 MB Ram machine
before the machine completely runs out of memory?
Sounds mighty strange to me...
There are two things to consider here:

1) In low memory conditions your application will use less memory (try
opening many high memory usage applications and see for yourself). You get a
similar effect when you application is minimised and restored.

**** Note that minimizing app's only results in trimming of the WS, that is pages are returned to the paging file, or are simply
freed when read-only pages.
2) Most of that memory usage is the framework itself.. which *should* be
shared between applications running at the same time (someone correct me if
I'm wrong with this). If I'm right on this, having many .NET apps open at
once should take less memory than having many (similar) non-.net apps open.
**** You are (unfortunately) wrong here, FCL (Jitted) code is non-shared, only a part is shared code (the native code DLL's).
Basically ignore what the task manager is telling you and just write your
program.

-- Pete

Nov 15 '05 #16
Willy Denoyette [MVP] <wi*************@pandora.be> wrote:
While it's possible for the CLR to return virtual memory to the
OS (Commited or reserved) by calling VirtualFree I never saw he did
under memory pressure. The only thing I see is that the OS trims the
WS by returning unused (unaccessed) pages to swap file when
there is ample memory. As to your remark "The CLR responds to memory
requirements of other apps", how do you think the CLR knows about
memory requirements of other app's?


I don't know the details of how it does it, but it definitely responds
to memory pressure. A while ago in the framework group someone was
asking about a program which crashed when there was still garbage
available to be collected. When two of the programs were run at the
same time, however, the runtime noticed that there was memory pressure
and ran the garbage collector more often.

I know I read about it somewhere, but I can't for the life of me find
the article now... it could be that I was misinterpreting things, of
course.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #17
Hi,

Willy Denoyette [MVP] wrote:
**** Note that minimizing app's only results in trimming of the WS,
that is pages are returned to the paging file, or are simply freed
when read-only pages.
Is there a difference that matters?
**** You are (unfortunately) wrong here, FCL (Jitted) code is
non-shared, only a part is shared code (the native code DLL's).


Are you sure? Memory usage for the first .NET app I open appears to be
around 8 meg (watching freeram xp pro's system memory monitor drop), whereas
the second app open at the same time uses only 3. It's the same in reverse
(8 then 3). Under task manager both are shown to use roughly 11MB of memory.
Surely such a discrepancy cannot be entirely the native DLL's?
Basically ignore what the task manager is telling you and just write
your program.


This is still true.

-- Pete
Nov 15 '05 #18
Pete,
See inline ****

Willy.

"Pete" <pv*****@gawab.com> wrote in message news:fb*********************@newsfep2-win.server.ntli.net...
Hi,

Willy Denoyette [MVP] wrote:
**** Note that minimizing app's only results in trimming of the WS,
that is pages are returned to the paging file, or are simply freed
when read-only pages.
Is there a difference that matters?


*** Yes, note that we are talking about virtual memory, that is the total of real RAM and page file space. When trimming the WS, RW
pages are moved from memory to the paging file, this does not necessarily reduce the VM size of the process, the net result is a
performance drop due to disk I/O when paging (in/out).
**** You are (unfortunately) wrong here, FCL (Jitted) code is
non-shared, only a part is shared code (the native code DLL's).


Are you sure? Memory usage for the first .NET app I open appears to be
around 8 meg (watching freeram xp pro's system memory monitor drop), whereas
the second app open at the same time uses only 3. It's the same in reverse
(8 then 3). Under task manager both are shown to use roughly 11MB of memory.
Surely such a discrepancy cannot be entirely the native DLL's?


*** If you look at a non NGEN'ed managed application, the shared pages are filled with:

- The C runtime library (msvcr.dll, msvcrxx.dll)
- The CLR (mscoree.dll, mscorwks.dll (or mscorsvr.dll) and mscorlib.dll, mscorjit.dll)
- Native kernel modules (Advapi32.dll, kernel32.dll, user32.dll, gdi32.dll, shell32.dll, etc......)
- COM (rpcrt4.dll, ole32.dll, oleaut.dll)
This part accounts for a large amount reserved RO/ RW memory (RO part can be shared amongst all other processes managed/unmanaged).
The amount depends on the number of pages already loaded by other (unmanaged/managed processes.
When you start another instance (or any other managed application) only part of the shared code has to be mapped, resulting in a
smaller memory footprint (virtually !).

Managed code however, is stored in private pages when Jitted and can as such not be shared. The result is a larger WS for managed
code compared to non managed code.

Basically ignore what the task manager is telling you and just write
your program.


This is still true.

-- Pete

Nov 15 '05 #19
I have a much worse problem. The memory usage of my .Net application keeps
climbing up, eventually the application will crash with an "Out Of Memory"
error. At that point, the page file size reached 1.45GB. The action of
minimizing the form will make the Mem Usage drop from hundreds of MB to a
few MB, but the VM remains the same huge number and keeps increasing, and
the Mem Usage will climb back even with the form minimized.

Any idea how to debug a memory leak in C# .Net applications? My aplication
creates thousands of small objects in local scope, most of them strings. I
expect the GC would free the memory once the objects are out of scope, but
it seems our garbage man cannot sweep fast enough.

Angie

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
How come .Net applications use so much memory? Every application I compile
uses at least 10 MB of memory, even the ones consisting of only a form and
nothing else. If I minimize them though the memory usage drops to a couple
hundred KB. Why?

Is there anything I should to to prevent this? I have compiled in release
and deactivated all forms of debugging, I think!

Thanks,
Philip

Nov 15 '05 #20
You can use a memory profiler, like the Scitech .Net Memory Profiler
(www.scitech.se). There are others too. With such a tool, you can see what's
still hanging around and what's referencing it. You could also try throwing
a few GC.Collect calls into your code to see if they actually change
anything. If they do, it seems that the GC is not running fast enough... if
they don't, it seems that your objects are not ready to be collected.

BTW, you can also use the performance monitor to watch the frequency and
activity of GC behaviour...

Niall

"Angie Ye" <ay*****@hotmail.com> wrote in message
news:bj**********@sun-news.laserlink.net...
I have a much worse problem. The memory usage of my .Net application keeps
climbing up, eventually the application will crash with an "Out Of Memory"
error. At that point, the page file size reached 1.45GB. The action of
minimizing the form will make the Mem Usage drop from hundreds of MB to a
few MB, but the VM remains the same huge number and keeps increasing, and
the Mem Usage will climb back even with the form minimized.

Any idea how to debug a memory leak in C# .Net applications? My aplication
creates thousands of small objects in local scope, most of them strings. I
expect the GC would free the memory once the objects are out of scope, but
it seems our garbage man cannot sweep fast enough.

Angie

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the memory usage drops to a couple hundred KB. Why?

Is there anything I should to to prevent this? I have compiled in release and deactivated all forms of debugging, I think!

Thanks,
Philip


Nov 15 '05 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
4
by: Dan K. | last post by:
Hi NG, first of all i am new to OOP and C# so maybe thats my whole problem :) i wrote a small timer application, like i did if i was starting with programming in vb long time ago. the vb...
1
by: Damien | last post by:
Hi guys, I'm looking for ideas for troubleshooting the following. We've tried some random things to try to treat the symptoms, but none seem robust enough to use when we go live, and we'd rather...
0
by: Dinesh | last post by:
Hi, We are seeing high memory usage (1GB) and subsequently out of memory exception. We are trying to transform the documents using xslt and most importantly using Assembly.Evidence to avoid...
2
by: Mechul | last post by:
Hi people i need serious help here.. I have a forum and my hosting company suspended it cuz of the high usage of sql. We did everything to make lower the usage but its still high. it was ...
2
by: Sin Jeong-hun | last post by:
In short, is there any way to know the very code that is currently hogging the CPU? I've written an application which continously GETting web pages using HttpWebRequest's asynchronous methods...
8
by: Diggla | last post by:
I was asked to look into a performance problem on a newly migrated DB server. The db server was moved from a local-physical-nt4-sybase to remote (10 mb wan link), virtual, Windows 2003, SQL...
1
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after...
17
by: Cesar | last post by:
Hello people. I'm having a Winform app that contains a webbrowser control that keeps navigating from one page to another permanentrly to make some tests. The problem I'm having is that after a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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

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