X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/184b5d99a5382cd7a19888c85aff11f8a21af2f6..0b746ba80548673d8f9bfed0ea4b1ed45c971ed1:/src/common/memory.cpp?ds=sidebyside diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 37bf42aa41..55a2a2b341 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -49,7 +49,7 @@ # endif #endif -#if !defined(__WATCOMC__) && !defined(__VMS__) +#if !defined(__WATCOMC__) && !defined(__VMS__) && !defined( __MWERKS__ ) #include #endif @@ -902,11 +902,15 @@ int wxDebugContext::Check(bool checkAll) // Count the number of non-wxDebugContext-related objects // that are outstanding -int wxDebugContext::CountObjectsLeft(void) +int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint) { int n = 0; - - wxMemStruct *from = wxDebugContext::GetHead (); + + wxMemStruct *from = NULL; + if (sinceCheckpoint && checkPoint) + from = checkPoint->m_next; + if (from == (wxMemStruct*) NULL) + from = wxDebugContext::GetHead () ; for (wxMemStruct * st = from; st != 0; st = st->m_next) { @@ -951,7 +955,28 @@ void * operator new (size_t size, char * fileName, int lineNum) #endif } -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) +// Added JACS 25/11/98 +void * operator new (size_t size) +{ +#ifdef NO_DEBUG_ALLOCATION + return malloc(size); +#else + return wxDebugAlloc(size, NULL, 0, FALSE); +#endif +} + +#if wxUSE_ARRAY_MEMORY_OPERATORS +void * operator new[] (size_t size) +{ +#ifdef NO_DEBUG_ALLOCATION + return malloc(size); +#else + return wxDebugAlloc(size, NULL, 0, FALSE, TRUE); +#endif +} +#endif + +#if wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size, char * fileName, int lineNum) { #ifdef NO_DEBUG_ALLOCATION @@ -986,7 +1011,7 @@ void operator delete[](void* pData, char* /* fileName */, int /* lineNum */) } #endif -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) +#if wxUSE_ARRAY_MEMORY_OPERATORS void operator delete[] (void * buf) { @@ -1011,7 +1036,8 @@ void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bo return (void *)malloc(size); } - char * buf = (char *) malloc(wxDebugContext::TotSize (size)); + int totSize = wxDebugContext::TotSize (size); + char * buf = (char *) malloc(totSize); if (!buf) { wxLogDebug("Call to malloc (%ld) failed.", (long)size); return 0;