473,396 Members | 1,996 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,396 software developers and data experts.

GC, Should I care?

Hi,

I am trying to track a suspected memory leak in an application I'm writing
and through repeated simplification of my project, I have found the
following which is quite easily replicated should you be prepared to give me
5 minutes of your time...

Create a new C# (Probably the same in VB dotNET but I've not tried it)
Windows application with 2 forms, the default form -Form1 and one other one.
that has a bunch of controls on it (say 20 buttons, 20 labels and a
DataGrid) - Form2.

On the default form, add a button to display the second form with some code
like:

private void button1_Click(object sender, System.EventArgs e)
{
using (form2 formTwo = new form2())
{
form2.ShowDialog();
}
}

also on Form1 add a label, and a timer that updates the label text as
follows (updates every 5 seconds -Interval = 5000-):

private void timer1_Tick(object sender, System.EventArgs e)
{
label1.Text = GC.GetTotalMemory(False);
}

and finally a button that forces a Garbage Collection:

private button2_Click(object sender, System.EventArgs e)
{
GC.Collect();
}

OK, my question/query is this, if I repeatedly click the button to open the
second form, then close the second form, click the button, close the form
etc. about 20-30 times, the display of GetTotalMemory seems to keep going
up, and even after forcing Garbage Collections, never seems to get fully
reclaimed. Should I care? and if I should, what (if anything) can I do about
it?

I would really appreciate an answer from someone who understands these
things...

Thanks a lot,

Chris.
Jul 21 '05 #1
0 1021

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

Similar topics

11
by: Don Bruder | last post by:
Got a stumper here. I imagine that for someone experienced in C++, this is too pathetic for words. For a rookie, using this project as a sort of "midterm exam" in his self-taught "how to program in...
1
by: mrskkoroma | last post by:
Dear friend, I am Mrs.kate koroma wife to the late john koroma from Sierra Leon. I am writing you in absolute confidence prmarily to seek your assistance to transfer our cash of($12,000.000.00)...
354
by: Montrose... | last post by:
After working in c# for a year, the only conclusion I can come to is that I wish I knew c. All I need is Linux, the gnu c compiler and I can do anything. Web services are just open sockets...
1
by: Bartje | last post by:
Hey, I am wondering what the best solution will be to program the following problem in access, the dutch 97 edition. I am developing a database for a day care centre (for my girlfriend). This...
12
by: polite person | last post by:
I posted a reply to his scatter chart problem over 24 hours ago and still he hasn't replied!
8
by: Simon Willison | last post by:
Hi all, I have an API design question. I'm writing a function that can either succeed or fail. Most of the time the code calling the function won't care about the reason for the failure, but...
122
by: ivan | last post by:
hi all, if I have: if(A && B || C) which operation gets executed first? If I remeber well should be &&, am I correct? thanks
1
by: =?Utf-8?B?V2luIERlZmVuZGVyIEluc3RhbGF0aW9uIGVycm9y | last post by:
I atempted to instal Windows Defender program. But a error: " first remove Windows one care program first" I uninstaled the program via the uninstal wizard & rebooted my HP Media Center 2005 xp....
2
by: =?Utf-8?B?cGlwZGV2?= | last post by:
Two PCs linked by ethernet cable:- This one - Clarencetoo The other - Claratoo both running XP cannot share printer attached to Claratoo with this PC. This is a new problem as of some 3 or...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.