Re: win32 design patterns



"Ben Voigt [C++ MVP]" wrote:
[...] This non-deterministic cleanup creates a race condition.
An alternate example is, since the GC is triggered by memory
pressure, a database connection pool could be exhausted by
unreachable objects waiting to be finalized, but the GC will not
run because it doesn't know that resources are scarce and a
collection is needed.

That's why C# provides `using' statement. It is equivalent to
C++'s RAII. After all, .NET programs have orders of magnitude
fewer leaks than comparable native programs.

Alex


.