1234567891011121314151617181920212223242526272829303132 |
- #ifndef _TOOLKIT_MEMORY_TRACE_CPP_H__
- #define _TOOLKIT_MEMORY_TRACE_CPP_H__
- #include "memutil.h"
- inline void* operator new(std::size_t size) throw (std::bad_alloc) {
- void* ptr = malloc(size);
- if (ptr == NULL) throw std::bad_alloc();
- return ptr;
- }
- inline void* operator new[](std::size_t size) throw (std::bad_alloc) {
- void* ptr = malloc(size);
- if (ptr == NULL) throw std::bad_alloc();
- return ptr;
- }
- inline void operator delete (void* ptr) throw() { free(ptr); }
- inline void operator delete[](void* ptr) throw() { free(ptr); }
- inline void* operator new(std::size_t size, const std::nothrow_t&) throw() {
- return malloc(size);
- }
- inline void* operator new[](std::size_t size,
- const std::nothrow_t&) throw() {
- return malloc(size);
- }
- inline void operator delete(void* ptr, const std::nothrow_t&) throw() {
- free(ptr);
- }
- inline void operator delete[](void* ptr, const std::nothrow_t&) throw() {
- free(ptr);
- }
- #endif /*_TOOLKIT_MEMORY_TRACE_CPP_H__*/
|