Fixed memory checking on Unix by removing inlines and apply patch
by Mart Raudsepp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -70,36 +70,18 @@ WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false);
|
|||||||
#define wxUSE_ARRAY_MEMORY_OPERATORS 0
|
#define wxUSE_ARRAY_MEMORY_OPERATORS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline void * operator new (size_t size, wxChar * fileName, int lineNum)
|
void * operator new (size_t size, wxChar * fileName, int lineNum);
|
||||||
{
|
|
||||||
return wxDebugAlloc(size, fileName, lineNum, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void * operator new (size_t size)
|
void * operator new (size_t size);
|
||||||
{
|
|
||||||
return wxDebugAlloc(size, NULL, 0, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void operator delete (void * buf)
|
void operator delete (void * buf);
|
||||||
{
|
|
||||||
wxDebugFree(buf, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxUSE_ARRAY_MEMORY_OPERATORS
|
#if wxUSE_ARRAY_MEMORY_OPERATORS
|
||||||
inline void * operator new[] (size_t size)
|
void * operator new[] (size_t size);
|
||||||
{
|
|
||||||
return wxDebugAlloc(size, NULL, 0, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void * operator new[] (size_t size, wxChar * fileName, int lineNum)
|
void * operator new[] (size_t size, wxChar * fileName, int lineNum);
|
||||||
{
|
|
||||||
return wxDebugAlloc(size, fileName, lineNum, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void operator delete[] (void * buf)
|
void operator delete[] (void * buf);
|
||||||
{
|
|
||||||
wxDebugFree(buf, true);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VC++ 6.0 and MWERKS
|
// VC++ 6.0 and MWERKS
|
||||||
|
@@ -910,19 +910,47 @@ private:
|
|||||||
bool m_locked;
|
bool m_locked;
|
||||||
};
|
};
|
||||||
|
|
||||||
MemoryCriticalSection &GetMemLocker()
|
|
||||||
{
|
|
||||||
static MemoryCriticalSection memLocker;
|
static MemoryCriticalSection memLocker;
|
||||||
return memLocker;
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void * operator new (size_t size, wxChar * fileName, int lineNum)
|
||||||
|
{
|
||||||
|
return wxDebugAlloc(size, fileName, lineNum, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void * operator new (size_t size)
|
||||||
|
{
|
||||||
|
return wxDebugAlloc(size, NULL, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete (void * buf)
|
||||||
|
{
|
||||||
|
wxDebugFree(buf, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_ARRAY_MEMORY_OPERATORS
|
||||||
|
void * operator new[] (size_t size)
|
||||||
|
{
|
||||||
|
return wxDebugAlloc(size, NULL, 0, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void * operator new[] (size_t size, wxChar * fileName, int lineNum)
|
||||||
|
{
|
||||||
|
return wxDebugAlloc(size, fileName, lineNum, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[] (void * buf)
|
||||||
|
{
|
||||||
|
wxDebugFree(buf, true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: store whether this is a vector or not.
|
// TODO: store whether this is a vector or not.
|
||||||
void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) )
|
void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) )
|
||||||
{
|
{
|
||||||
#if USE_THREADSAFE_MEMORY_ALLOCATION
|
#if USE_THREADSAFE_MEMORY_ALLOCATION
|
||||||
MemoryCriticalSectionLocker lock(GetMemLocker());
|
MemoryCriticalSectionLocker lock(memLocker);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If not in debugging allocation mode, do the normal thing
|
// If not in debugging allocation mode, do the normal thing
|
||||||
@@ -982,7 +1010,7 @@ void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject,
|
|||||||
void wxDebugFree(void * buf, bool WXUNUSED(isVect) )
|
void wxDebugFree(void * buf, bool WXUNUSED(isVect) )
|
||||||
{
|
{
|
||||||
#if USE_THREADSAFE_MEMORY_ALLOCATION
|
#if USE_THREADSAFE_MEMORY_ALLOCATION
|
||||||
MemoryCriticalSectionLocker lock(GetMemLocker());
|
MemoryCriticalSectionLocker lock(memLocker);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
|
Reference in New Issue
Block a user