_CrtDumpMemoryLeaks and <valarray>

G

Guest

Hi,

I want to track memory leaks in my application (that is using <valarray>).
I used the following code:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

But then, when I include <valarray> the compiler raises the following errors :

c:\[...].NET 2003\Vc7\include\valarray(367) : warning C4003: not enough
actual parameters for macro 'free'
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\[...].NET 2003\Vc7\include\valarray(427) : see reference to class
template instantiation 'std::valarray<_Ty>' being compiled
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\[...].NET 2003\Vc7\include\valarray(1124) : see reference to
class template instantiation 'std::valarray<_Ty>' being compiled
with
[
_Ty=size_t
]
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\[...].NET 2003\Vc7\include\valarray(1333) : see reference to
class template instantiation 'std::valarray<_Ty>' being compiled
with
[
_Ty=std::_Bool
]
c:\[...].NET 2003\Vc7\include\valarray(1335) : see reference to
class template instantiation 'std::mask_array<_Ty>' being compiled
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\DEV\mySoft\src\converTools\converTypes.h(85) : see reference to
class template instantiation 'std::valarray<_Ty>' being compiled
with
[
_Ty=double
]

It appeared with use of _CRTDBG_MAP_ALLOC macro and I think it leads to a
replacement of the free member-function in std::valarray class by the
debug-purpose defined free macro.

But I can't see how I should use those two elements correctly

Thanks

Dack
 
T

Tom Widmer

Dack said:
Hi,

I want to track memory leaks in my application (that is using <valarray>).
I used the following code:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

But then, when I include <valarray> the compiler raises the following errors :

c:\[...].NET 2003\Vc7\include\valarray(367) : warning C4003: not enough
actual parameters for macro 'free'
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\[...].NET 2003\Vc7\include\valarray(427) : see reference to class
template instantiation 'std::valarray<_Ty>' being compiled
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\[...].NET 2003\Vc7\include\valarray(1124) : see reference to
class template instantiation 'std::valarray<_Ty>' being compiled
with
[
_Ty=size_t
]
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\[...].NET 2003\Vc7\include\valarray(1333) : see reference to
class template instantiation 'std::valarray<_Ty>' being compiled
with
[
_Ty=std::_Bool
]
c:\[...].NET 2003\Vc7\include\valarray(1335) : see reference to
class template instantiation 'std::mask_array<_Ty>' being compiled
c:\[...].NET 2003\Vc7\include\valarray(367) : error C2059: syntax error : ','
c:\DEV\mySoft\src\converTools\converTypes.h(85) : see reference to
class template instantiation 'std::valarray<_Ty>' being compiled
with
[
_Ty=double
]

It appeared with use of _CRTDBG_MAP_ALLOC macro and I think it leads to a
replacement of the free member-function in std::valarray class by the
debug-purpose defined free macro.

But I can't see how I should use those two elements correctly

#include <valarray> before the other stuff.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top