When you are using threads on sharepoint, you should take care of some little things :
- The method used to launch the thread must have the “[STAThread]” attribute, it avoids some huge memory leaks.
- If you need to use an SPSite from the calling site, you should copy its URL and UserToken to build a new SPSite in the new thread. If you’re not using that “design pattern”, things will get really wrong.
- And of course you should dispose any sharepoint SPSite (SPWebs come from SPSite) allocated within the thread.