I'm trying to control mem leaks in my code. In my general header file I've added this code:
// You may need to locate mem leaks
#define ZEL_CHECK_MEMORY_LEAKS
#ifdef ZEL_CHECK_MEMORY_LEAKS
#define _CRTDBG_MAP_ALLOC
#include <cstdlib>
#include <crtdbg.h>
#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif // _DEBUG
#define zelInitMemoryCheck() \
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF)
#else
#define zelInitMemoryCheck()
#endif //ZEL_CHECK_MEMORY_LEAKS
If I add this code, I get this compilation error:
1>c:\archivos de programa\microsoft visual studio 9.0\vc\include\xlocmon(283) : error C2061: syntax error : identifier '_DebugHeapTag_func'
1> c:\archivos de programa\microsoft visual studio 9.0\vc\include\xlocmon(281) : while compiling class template member function 'size_t std::moneypunct<_Elem,_Intl>::_Getcat(const std::locale::facet **,const std::locale *)'
1> with
1> [
1> _Elem=char,
1> _Intl=true
1> ]
1> c:\archivos de programa\microsoft visual studio 9.0\vc\include\xlocmon(908) : see reference to class template instantiation 'std::moneypunct<_Elem,_Intl>' being compiled
1> with
1> [
1> _Elem=char,
1> _Intl=true
1> ]
In addition, In my source code I have this inclusion:
#include "core/zelCoreLib.h"
#include <boost/shared_ptr.hpp>
Where mem leak control code is into zelCoreLib.h
To those not have VC9.0 this is the code that "fails"
static size_t __CLRCALL_OR_CDECL _Getcat(const locale::facet **_Ppf = 0,
const locale *_Ploc = 0)
{ // return locale category mask and construct standard facet
if (_Ppf != 0 && *_Ppf == 0)
*_Ppf = _NEW_CRT moneypunct<_Elem, _Intl>(
_Locinfo(_Ploc->name()), 0, true);
return (_X_MONETARY);
}
It seems to be part of string and locale facilities. Also, as an additional information, I use Lua and LuaBind libs
Any help will be welcome