Y
Hacker News
new
|
ask
|
show
|
jobs
by
pjmlp
1264 days ago
That is what
using
declarations and
IDisposable
are for.
1 comments
superjan
1264 days ago
Exactly. Idiomatic C# code does not depend on finalizers to release resources. Finalizers are typically only used as a last resort to prevent handle leaks, it is only memory deallocation that is nondeterministic.
link
pjmlp
1264 days ago
And even then, SafeHandle is a much better option.
Memory deallocation can be done as deterministic as malloc/free via the native heap APIs.
link