Reputation: 6282
How important is it to correctly close an application?
That is, to property call Dispose
on all disposable objects and signal all worker threads to finish their work (and wait for them to do so).
I've been reading about bad practices concerning these things, but I rarely see any concrete examples as to what might go wrong.
Q: Are there any issues that may arise from doing any or all of the following things:
Dispose
on any disposable objects. (Can it cause a memory leak even after the process has been terminated?)Thread.Abort()
. (Ignoring the fact that it can potentially do nothing.)Application.Exit()
or Environment.Exit(0)
while the main thread and/or worker threads have not yet finished their work.Edit: Let's assume that said application is designed to run completely alone and independent of other applications, nor are there any other applications that directly depend on it.
Upvotes: 1
Views: 151
Reputation: 6689
None of the above are important as far as leaks or broader system issues.
However more often than not, bad patterns and habits will bite you in other ways you don't expect... such as when additional clients of code are added, or other tweaks over time.
Upvotes: 2