473,418 Members | 2,368 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,418 software developers and data experts.

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 4190
..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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
4
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password";...
20
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
7
by: Ragnar Agustsson | last post by:
Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written in C++, that leaks a...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.