/////////////////////////////////////////////////////////////////////////////
-// Name: memory.cpp
+// Name: src/common/memory.cpp
// Purpose: Memory checking implementation
// Author: Arthur Seaton, Julian Smart
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "memory.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/defs.h"
+ #pragma hdrstop
#endif
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-// #pragma implementation
-#endif
+#include "wx/memory.h"
#ifndef WX_PRECOMP
-#include "wx/utils.h"
-#include "wx/app.h"
-#include "wx/hash.h"
+ #include "wx/utils.h"
+ #include "wx/app.h"
+ #include "wx/hash.h"
+ #include "wx/log.h"
#endif
#if wxUSE_THREADS
-#include "wx/thread.h"
+ #include "wx/thread.h"
#endif
-#include "wx/log.h"
#include <stdlib.h>
#include "wx/ioswrap.h"
#endif
-#include "wx/memory.h"
-
#if wxUSE_THREADS && defined(__WXDEBUG__)
#define USE_THREADSAFE_MEMORY_ALLOCATION 1
#else
static MemoryCriticalSection memLocker;
-#endif
+#endif // USE_THREADSAFE_MEMORY_ALLOCATION
+
+#ifdef __WXDEBUG__
+#if !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)))
+#if wxUSE_GLOBAL_MEMORY_OPERATORS
void * operator new (size_t size, wxChar * fileName, int lineNum)
{
return wxDebugAlloc(size, fileName, lineNum, false, false);
{
wxDebugFree(buf, true);
}
-#endif
+#endif // wxUSE_ARRAY_MEMORY_OPERATORS
+#endif // wxUSE_GLOBAL_MEMORY_OPERATORS
+#endif // !(defined(__WXMSW__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)))
// TODO: store whether this is a vector or not.
void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) )
free((char *)st);
}
+#endif // __WXDEBUG__
+
// Trace: send output to the current debugging stream
void wxTrace(const wxChar * ...)
{
static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_One;
#endif // (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
-