Click here to Skip to main content
15,915,093 members
Home / Discussions / C#
   

C#

 
GeneralRe: resource leak in thread termination? Pin
George_George22-Apr-08 0:57
George_George22-Apr-08 0:57 
AnswerRe: resource leak in thread termination? Pin
Le centriste22-Apr-08 1:21
Le centriste22-Apr-08 1:21 
GeneralRe: resource leak in thread termination? Pin
George_George22-Apr-08 1:29
George_George22-Apr-08 1:29 
GeneralRe: resource leak in thread termination? Pin
Le centriste22-Apr-08 1:58
Le centriste22-Apr-08 1:58 
GeneralRe: resource leak in thread termination? Pin
George_George22-Apr-08 2:46
George_George22-Apr-08 2:46 
GeneralRe: resource leak in thread termination? Pin
Le centriste22-Apr-08 2:49
Le centriste22-Apr-08 2:49 
GeneralRe: resource leak in thread termination? Pin
George_George22-Apr-08 3:03
George_George22-Apr-08 3:03 
GeneralRe: resource leak in thread termination? Pin
Le centriste22-Apr-08 3:07
Le centriste22-Apr-08 3:07 
As a golden rule, you should always clean up behind you, and not rely on your mother to do it. Wink | ;)

Seriously, you could simply use the using statement, as finally blocks are always executed, no matter what. That will free you from having to handle the exceptions and still do the cleanup.

We should not rely on the Finalizers, as they are there as a last defense, and you don't know when they execute. Calling the Dispose method from a finally is a surefire way of cleaning up.
GeneralRe: resource leak in thread termination? Pin
George_George22-Apr-08 3:38
George_George22-Apr-08 3:38 
GeneralRe: resource leak in thread termination? Pin
Guffa22-Apr-08 3:30
Guffa22-Apr-08 3:30 
GeneralRe: resource leak in thread termination? Pin
George_George22-Apr-08 3:41
George_George22-Apr-08 3:41 
GeneralRe: resource leak in thread termination? Pin
Guffa22-Apr-08 7:25
Guffa22-Apr-08 7:25 
GeneralRe: resource leak in thread termination? Pin
George_George22-Apr-08 16:54
George_George22-Apr-08 16:54 
GeneralRe: resource leak in thread termination? Pin
Guffa27-Apr-08 5:28
Guffa27-Apr-08 5:28 
GeneralRe: resource leak in thread termination? Pin
George_George27-Apr-08 17:44
George_George27-Apr-08 17:44 
GeneralRe: resource leak in thread termination? Pin
Guffa27-Apr-08 23:51
Guffa27-Apr-08 23:51 
GeneralRe: resource leak in thread termination? Pin
George_George28-Apr-08 1:27
George_George28-Apr-08 1:27 
GeneralRe: resource leak in thread termination? Pin
Guffa28-Apr-08 2:00
Guffa28-Apr-08 2:00 
GeneralRe: resource leak in thread termination? Pin
George_George28-Apr-08 2:14
George_George28-Apr-08 2:14 
GeneralRe: resource leak in thread termination? Pin
Guffa28-Apr-08 3:18
Guffa28-Apr-08 3:18 
GeneralRe: resource leak in thread termination? Pin
George_George28-Apr-08 3:56
George_George28-Apr-08 3:56 
GeneralRe: resource leak in thread termination? Pin
Guffa28-Apr-08 14:31
Guffa28-Apr-08 14:31 
GeneralRe: resource leak in thread termination? Pin
George_George29-Apr-08 2:41
George_George29-Apr-08 2:41 
GeneralRe: resource leak in thread termination? Pin
Guffa29-Apr-08 8:37
Guffa29-Apr-08 8:37 
GeneralRe: resource leak in thread termination? Pin
George_George29-Apr-08 21:50
George_George29-Apr-08 21:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.