Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GC Not Collecting???
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
GC Not Collecting???
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01038351
Message ID:
01038351
Views:
54
I have this control test that may or may not be a valid - I'm open to a test that would show real world results if anyone has one to share...

But for now here's what I got:
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;

...

	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		
		private TextWriterTraceListener myListener;
		private long mem = 0;
		private long prevMem = 0;

...

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			myListener = new TextWriterTraceListener(@"C:\log.txt");
			Trace.Listeners.Add(myListener);
			Trace.AutoFlush = true;
		}

...

		private void button1_Click(object sender, System.EventArgs e)
		{
			Trace.WriteLine("Starting Hash Table Test in Debug Mode");

			System.Collections.Hashtable ht = null;
		
			for(int x = 0;x< 100000;x++)
			{
				try
				{
					ht = new Hashtable(10000);
					label1.Text = "Count = " + x.ToString();
					mem = System.Environment.WorkingSet/1024;

					if(x%10000 == 0)
					{
						Trace.WriteLine("Current Iteration: " + x.ToString() + " - Memory: " + mem.ToString() + "kb");
					}

					if(Math.Abs(mem - prevMem) > 1024)
					{
						prevMem = mem;
						Trace.WriteLine("Current Iteration: " + x.ToString() + " - Memory: " + mem.ToString() + "kb");
					}

					label2.Text = "Working Set Memory: " + mem.ToString() + "kb"; 
					this.Refresh(); 
					Application.DoEvents();
				}
				catch(Exception ex)
				{
					label1.Text = "Count = " + x.ToString() + "\r\n" + ex.Message;
					label2.Text = "Working Set Memory: " + (System.Environment.WorkingSet/1024).ToString() + "kb"; 
					this.Refresh(); 
					Application.DoEvents();
				}
				finally
				{
					ht = null;
				}
			}
			Trace.WriteLine("Final Iteration " + " - Memory: " + mem.ToString() + "kb");
			Trace.WriteLine("Ending Test!");
			Trace.Flush();
		}
In this test the memory consumption keep climbing and climbing. In a test where we did a while() test for 12 hours instead of a foreach the memory kept depleating until the system came to a crawl...

The system never crashed - just came to a very slow crawl.

Any ideas???
Next
Reply
Map
View

Click here to load this message in the networking platform