Article ID: 815235 - View products that this article applies to.
In a multithreaded application, if a DLL's DllMain makes a call to _set_se_translator, you may experience a memory leak in the CRT.
This problem occurs if you used the _beginthreadex API to create the thread because the initialization order in the CRT causes the per thread data (PTD) structure for the thread to be allocated two times.
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.
Note You must have a Visual Studio license agreement to obtain this hotfix.
To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=supportNote In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Date Time Version Size File name ------------------------------------------------------ 22-Feb-2003 04:42 3,218,510 Libcmtd.lib 22-Feb-2003 04:46 6.0.9748.0 434,252 Msvcrtd.dll 22-Feb-2003 04:33 934,378 Libcmt.lib 22-Feb-2003 05:45 6.0.9748.0 278,581 Msvcrt.dll 22-Feb-2003 03:42 6,615 Thread.c 22-Feb-2003 03:42 8,554 Threadex.c
You can avoid this problem by calling _set_se_translator at the beginning of your thread procedure instead of in DllMain. It is not a good idea to call CRT functions such as _set_se_translator in DllMain.
You can also work around the problem by using CreateThread instead of _beginthreadex to start your threads.
Article ID: 815235 - Last Review: October 21, 2005 - Revision: 1.4
Contact us for more help
Connect with Answer Desk for expert help.