![]() |
QxOrm 1.1.9
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 QxOrm France and/or its subsidiary(-ies) 00004 ** Contact: QxOrm France Information (contact@qxorm.com) 00005 ** 00006 ** This file is part of the QxOrm library 00007 ** 00008 ** Commercial Usage 00009 ** Licensees holding valid QxOrm Commercial licenses may use this file in 00010 ** accordance with the QxOrm Commercial License Agreement provided with the 00011 ** Software or, alternatively, in accordance with the terms contained in 00012 ** a written agreement between you and QxOrm France 00013 ** 00014 ** GNU General Public License Usage 00015 ** Alternatively, this file may be used under the terms of the GNU 00016 ** General Public License version 3.0 as published by the Free Software 00017 ** Foundation and appearing in the file 'license.gpl3.txt' included in the 00018 ** packaging of this file. Please review the following information to 00019 ** ensure the GNU General Public License version 3.0 requirements will be 00020 ** met: http://www.gnu.org/copyleft/gpl.html 00021 ** 00022 ** If you are unsure which license is appropriate for your use, please 00023 ** contact the support department at support@qxorm.com 00024 ** 00025 ****************************************************************************/ 00026 00027 /*** http://wyw.dcweb.cn/leakage.htm ***/ 00028 00029 #ifndef NDEBUG 00030 #ifndef QT_NO_DEBUG 00031 #if _QX_USE_MEM_LEAK_DETECTION 00032 00033 #define _DEBUG_NEW_REDEFINE_NEW 0 00034 #include "debug_new.h" 00035 00036 #ifdef _MSC_VER 00037 #pragma warning(disable: 4290) // C++ exception specification ignored 00038 #endif // _MSC_VER 00039 00040 #ifndef QX_MEM_LEAK_STATIC_OR_INLINE 00041 #ifdef _MSC_VER 00042 #define QX_MEM_LEAK_STATIC_OR_INLINE static 00043 #else 00044 #define QX_MEM_LEAK_STATIC_OR_INLINE inline 00045 #endif // _MSC_VER 00046 #endif // QX_MEM_LEAK_STATIC_OR_INLINE 00047 00048 QX_MEM_LEAK_STATIC_OR_INLINE void * operator new(size_t size) throw(std::bad_alloc) { return operator new(size, (char *)_DEBUG_NEW_CALLER_ADDRESS, 0); }; 00049 QX_MEM_LEAK_STATIC_OR_INLINE void * operator new[](size_t size) throw(std::bad_alloc) { return operator new[](size, (char *)_DEBUG_NEW_CALLER_ADDRESS, 0); }; 00050 QX_MEM_LEAK_STATIC_OR_INLINE void operator delete(void * pointer) throw() { qx::memory::__debug_new_recorder::free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, false); }; 00051 QX_MEM_LEAK_STATIC_OR_INLINE void operator delete[](void * pointer) throw() { qx::memory::__debug_new_recorder::free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, true); }; 00052 00053 #if HAVE_PLACEMENT_DELETE 00054 QX_MEM_LEAK_STATIC_OR_INLINE void operator delete(void * pointer, const std::nothrow_t &) throw() { operator delete(pointer, (char *)_DEBUG_NEW_CALLER_ADDRESS, 0); }; 00055 QX_MEM_LEAK_STATIC_OR_INLINE void operator delete[](void * pointer, const std::nothrow_t &) throw() { operator delete[](pointer, (char *)_DEBUG_NEW_CALLER_ADDRESS, 0); }; 00056 #endif // HAVE_PLACEMENT_DELETE 00057 00058 #ifdef new 00059 #undef new 00060 #endif // new 00061 #define new DEBUG_NEW 00062 00063 #endif // _QX_USE_MEM_LEAK_DETECTION 00064 #endif // QT_NO_DEBUG 00065 #endif // NDEBUG 00066 00067 #if (! _QX_USE_MEM_LEAK_DETECTION) 00068 #ifndef DEBUG_NEW 00069 #define DEBUG_NEW new 00070 #endif // DEBUG_NEW 00071 #endif // (! _QX_USE_MEM_LEAK_DETECTION) 00072 00073 #ifdef NDEBUG 00074 #ifndef DEBUG_NEW 00075 #define DEBUG_NEW new 00076 #endif // DEBUG_NEW 00077 #endif // NDEBUG