Stealth Player Development

My MicroISV. Where software development and pornography collide...

Subscribe in NewsGator Online

Saturday, January 15, 2005

Memory Leaks - Not just for applications

What’s worse than a memory leak in your application? Not remembering what caused the memory leak last time when I fixed it! For the record, Stealth Player is built using a .NET Windows Forms front end. It’s not so much that the memory leaks, that I can’t find the root object in the stack holding a reference to the objects I want garbage collected in the heap. Some of the usual culprits I’ve found are event handlers, delegates (same issue as with events), and an oddity with multi threaded programming in windows.

Now I know UI elements need to be updated using the same thread that created them…I understand how to use Invoke and BeginInvoke on the control. But there seems to be a problem with the handle for the control hasn’t been created. The Invoke function will cause an exception, and for some reason a reference will be held to the control/object that I want garbage collected later.

I'll post a sample and a fix when I figure it out.


Post a Comment

<< Home