Vinayak said:
Threads created using the CreateThread API used to leak memory if you
accesed any crt methods within the thread proc. we used to use
_beginthread to work around this issue.
Does anyone know if this has been fixed ?
The situation has not changed, nor will it ever (on Win32 at least). The
problem fundamentally is that there's no way to register a fully reliable
"atexit" mechanism that always works regardless of how the process ends,
except by using a DLL.
Under VC7.1, as was the case with previous versions of VC++, if you use the
DLL version of the CRT, your resources will in fact be reclaimed when the
CRT DLL is unloaded. If you use the static CRT, unless your program shuts
down normally, CRT resources will be leaked. In practice, there's little
consequence to this, since the OS will reclaim the resources anyway. It's
possible though that unflushed I/O buffers will be lost, etc.
In any case, using _beginthread{ex} is still the recommended procedure.
-cd