﻿# Memory Leak - solved - or 'When STAThread Goes Bad'

<datetime class="hidden">2004-02-20T00:00</datetime>
<!-- category -- mostlylucidcouk, Imported, .NET, C# -->

I posted a little while ago about an odd 'Memory Leak' I was having...well, after several days of trawling (and annoying [Data Wanta](http://weblogs.asp.net/dwanta/)who's excellent email [component](http://www.aspnetemail.com/) I was mistakenly blaming - sorry!), I finally found the answer! Turns out that the little [STAThread] attribute above the main class of the Comand Line app isn't so inoccuous after all - Dave pointed out [this thread](http://groups.google.com/groups?hl=en&amp;lr=&amp;ie=UTF-8&amp;oe=UTF-8&amp;frame=right&amp;th=d80d655cf0d70930&amp;seekm=ef9gTVwLDHA.1720%40TK2MSFTNGP11.phx.gbl#link1) - apparently there's some sort of [bug in .NET](http://groups.google.com/groups?hl=en&amp;lr=&amp;ie=UTF-8&amp;oe=UTF-8&amp;selm=eXa3ObcPDHA.3192%40tk2msftngp13.phx.gbl)  which can lead to what is effectively a leak when using multi-threading in a STAThreaded application!