470,593 Members | 2,387 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,593 developers. It's quick & easy.

Memory leak

Hi to all.
My program starts at about 7000 KB memory consumption.
After few hours it gets to over 200 MB.
Running GC.Collect() periodically did not help, so it must be a leak.
How can i find where the memory is going?
Thanks, Sharon.
Nov 16 '05 #1
5 4017
..NET/CLR will use as much memory as is available until extrenal memory
pressure forces Windows to reduce the working set of the application - try
it, do some other memory-intensive things while you app is idling and you'll
see the memory used by your app decrease.

Note that even if objects are collected inside the CLR, that does NOT mean
the working set (the physically allocated memory) will be reduced. There
are ways of doing this however they are not generally recommneded and
require invoking Win32 API calls.

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Sharon" <sh****@void.null> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
Hi to all.
My program starts at about 7000 KB memory consumption.
After few hours it gets to over 200 MB.
Running GC.Collect() periodically did not help, so it must be a leak.
How can i find where the memory is going?
Thanks, Sharon.

Nov 16 '05 #2
Thanks Richard.
I've tried it and .NET does behave as you say.
Still, 200MB memory consumption is alarming :)
At least its not a leak.
Sharon.

"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
.NET/CLR will use as much memory as is available until extrenal memory
pressure forces Windows to reduce the working set of the application - try
it, do some other memory-intensive things while you app is idling and you'll see the memory used by your app decrease.

Note that even if objects are collected inside the CLR, that does NOT mean
the working set (the physically allocated memory) will be reduced. There
are ways of doing this however they are not generally recommneded and
require invoking Win32 API calls.

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Sharon" <sh****@void.null> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
Hi to all.
My program starts at about 7000 KB memory consumption.
After few hours it gets to over 200 MB.
Running GC.Collect() periodically did not help, so it must be a leak.
How can i find where the memory is going?
Thanks, Sharon.


Nov 16 '05 #3
Actually reducing the workingset doesn't require a p/invoke... just try
this:

System.Diagnostics.Process.GetCurrentProcess().Max WorkingSet =
System.Diagnostics.Process.GetCurrentProcess().Min WorkingSet;

--
John Wood
Blog: http://spaces.msn.com/members/johnwood

"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
.NET/CLR will use as much memory as is available until extrenal memory
pressure forces Windows to reduce the working set of the application - try
it, do some other memory-intensive things while you app is idling and you'll see the memory used by your app decrease.

Note that even if objects are collected inside the CLR, that does NOT mean
the working set (the physically allocated memory) will be reduced. There
are ways of doing this however they are not generally recommneded and
require invoking Win32 API calls.

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Sharon" <sh****@void.null> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
Hi to all.
My program starts at about 7000 KB memory consumption.
After few hours it gets to over 200 MB.
Running GC.Collect() periodically did not help, so it must be a leak.
How can i find where the memory is going?
Thanks, Sharon.


Nov 16 '05 #4
I find it interesting that it is "alarming" (something most other people
who see this for the first time assume as well).

I mean, as long as the CLR gives back memory when the OS needs it, there
shouldn't be an issue. The CLR takes what it needs when it is available,
and returns it when told to by something more authoritative (the OS). There
is no reason to have all those resources go to waste =)
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sharon" <ta*******@void.null> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks Richard.
I've tried it and .NET does behave as you say.
Still, 200MB memory consumption is alarming :)
At least its not a leak.
Sharon.

"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
.NET/CLR will use as much memory as is available until extrenal memory
pressure forces Windows to reduce the working set of the application -
try
it, do some other memory-intensive things while you app is idling and

you'll
see the memory used by your app decrease.

Note that even if objects are collected inside the CLR, that does NOT
mean
the working set (the physically allocated memory) will be reduced. There
are ways of doing this however they are not generally recommneded and
require invoking Win32 API calls.

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Sharon" <sh****@void.null> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
> Hi to all.
> My program starts at about 7000 KB memory consumption.
> After few hours it gets to over 200 MB.
> Running GC.Collect() periodically did not help, so it must be a leak.
> How can i find where the memory is going?
> Thanks, Sharon.
>
>



Nov 16 '05 #5
The biggest issue are the users who aren't clever (or interested) enough to
understand memory management in the CLR, but who have been told by someone
what the task manager is for.

I guess the problem is that it just *looks* bad...

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ux**************@TK2MSFTNGP10.phx.gbl...
I find it interesting that it is "alarming" (something most other people who see this for the first time assume as well).

I mean, as long as the CLR gives back memory when the OS needs it, there shouldn't be an issue. The CLR takes what it needs when it is available,
and returns it when told to by something more authoritative (the OS). There is no reason to have all those resources go to waste =)
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sharon" <ta*******@void.null> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks Richard.
I've tried it and .NET does behave as you say.
Still, 200MB memory consumption is alarming :)
At least its not a leak.
Sharon.

"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
.NET/CLR will use as much memory as is available until extrenal memory
pressure forces Windows to reduce the working set of the application -
try
it, do some other memory-intensive things while you app is idling and

you'll
see the memory used by your app decrease.

Note that even if objects are collected inside the CLR, that does NOT
mean
the working set (the physically allocated memory) will be reduced. There are ways of doing this however they are not generally recommneded and
require invoking Win32 API calls.

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Sharon" <sh****@void.null> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
> Hi to all.
> My program starts at about 7000 KB memory consumption.
> After few hours it gets to over 200 MB.
> Running GC.Collect() periodically did not help, so it must be a leak.
> How can i find where the memory is going?
> Thanks, Sharon.
>
>



Nov 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by ranjeet.gupta | last post: by
17 posts views Thread by Josť Joye | last post: by
4 posts views Thread by Don Nell | last post: by
20 posts views Thread by jeevankodali | last post: by
23 posts views Thread by James | last post: by
8 posts views Thread by Adrian | last post: by
7 posts views Thread by Salvador | last post: by
3 posts views Thread by Jim Land | last post: by
7 posts views Thread by Ragnar Agustsson | last post: by
22 posts views Thread by Peter | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.