October 20, 2005

_wsetlocale memory-leak with VC7.1 and static CRT

It seems that there is a huge memory-leak inside the _wsetlocale function of VC7.1 (VS2003 static CRT).

Here is a small code to reproduce the problem (stupid code, but it generates a very huge memory leak; several MBs/sec):

  #include <tchar.h>

#include <locale.h> int _tmain() { while(1) { _tsetlocale(LC_ALL, _T("C")); } return 0; }

Now you need to compile it with cl setlocale_bug.cpp /Od /MTd /D ”_UNICODE” /D “UNICODE”

If you start the resulting EXE, you can see very clear (in task-manager (virtual-bytes) or perfmon (private bytes)) that the memory is steadily growing…

But the good news is: It is fixed in VC2005 Beta 2.


Posted 2 years, 2 months ago on October 20, 2005
The trackback url for this post is http://blog.kalmbachnet.de/bblog/trackback.php/47/

Comments have now been turned off for this post