Memory leak when setting a label text in a timer event

  • Thread starter Thread starter yaktipper
  • Start date Start date
Y

yaktipper

VS.NET 2002, framework 1.0

I wrote a very simple program to display the RGB value and x,y mouse
position at the cursor on a 50ms timer.

I noticed a memory leak of 8K per timer event. The leak still occurs
after commenting out the code and simple having one line in the timer:

private void timerMouseColor_Tick(object sender, System.EventArgs e)
{

lblMousePos.Text = "";

}

Is there a workaround for this? After letting the program sit for a
while it naturally runs out of memory and terminates. Is this fixed
in VS.NET 2003, framework 1.1?
 
I've seen my share of GC not quite working as documented, but 1.1 is a
marked improvement.

Put the 1.1 Framework on and try for yourself. It's a free download.
To run your 1.0 code on the 1.1 Framework use this in your config file:

<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>

HTH;
Eric Cadwell
http://www.origincontrols.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top