Tidy up and activate the MSVC Debug Heap

This commit is contained in:
Vinnie Falco
2013-06-29 18:23:59 -07:00
parent e7bda30506
commit 386fea5e71
17 changed files with 973 additions and 292 deletions

View File

@@ -20,35 +20,23 @@
namespace Debug
{
//------------------------------------------------------------------------------
bool isDebuggerAttached ()
{
return beast_isRunningUnderDebugger ();
}
//------------------------------------------------------------------------------
#if BEAST_DEBUG && defined (beast_breakDebugger)
void breakPoint ()
{
if (isDebuggerAttached ())
#if BEAST_DEBUG
if (beast_isRunningUnderDebugger ())
beast_breakDebugger;
}
#else
void breakPoint ()
{
bassertfalse
}
bassertfalse;
#endif
}
//----------------------------------------------------------------------------
//------------------------------------------------------------------------------
#if BEAST_MSVC && defined (_DEBUG)
void setHeapAlwaysCheck (bool bAlwaysCheck)
void setAlwaysCheckHeap (bool bAlwaysCheck)
{
int flags = _CrtSetDbgFlag (_CRTDBG_REPORT_FLAG);
@@ -78,14 +66,21 @@ void setHeapReportLeaks (bool bReportLeaks)
_CrtSetDbgFlag (flags);
}
void reportLeaks ()
{
_CrtDumpMemoryLeaks ();
}
void checkHeap ()
{
_CrtCheckMemory ();
}
//------------------------------------------------------------------------------
#else
void setHeapAlwaysCheck (bool)
void setAlwaysCheckHeap (bool)
{
}
@@ -97,6 +92,10 @@ void setHeapReportLeaks (bool)
{
}
void reportLeaks ()
{
}
void checkHeap ()
{
}