mirror of https://gitlab.com/rnger/amath
Fixed wrong memory management with new
This commit is contained in:
parent
37d2ba4794
commit
2adc0edd4c
|
@ -43,29 +43,6 @@
|
|||
#define Debug(x,y,z,w)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if (__GNUC__ > 2)
|
||||
#include <new>
|
||||
void* operator new (size_t size) throw(std::bad_alloc) {
|
||||
return AllocMemSafe(size);
|
||||
}
|
||||
|
||||
void* operator new[] (size_t size) throw(std::bad_alloc) {
|
||||
return AllocMemSafe(size);
|
||||
}
|
||||
|
||||
void operator delete (void* ptr) throw() {
|
||||
FreeMemSafe(ptr);
|
||||
}
|
||||
|
||||
void operator delete[] (void* ptr) throw() {
|
||||
FreeMemSafe(ptr);
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct MemoryBlock
|
||||
{
|
||||
struct MemoryBlock *next;
|
||||
|
|
|
@ -148,6 +148,28 @@ inline void operator delete[] (void* ptr) {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if (__GNUC__ > 2)
|
||||
#include <new>
|
||||
inline void* operator new (size_t size) throw(std::bad_alloc) {
|
||||
return AllocMemSafe(size);
|
||||
}
|
||||
|
||||
inline void* operator new[] (size_t size) throw(std::bad_alloc) {
|
||||
return AllocMemSafe(size);
|
||||
}
|
||||
|
||||
inline void operator delete (void* ptr) throw() {
|
||||
FreeMemSafe(ptr);
|
||||
}
|
||||
|
||||
inline void operator delete[] (void* ptr) throw() {
|
||||
FreeMemSafe(ptr);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ANSICONSOLE)
|
||||
#define HEADLINE "\x1B[1m"
|
||||
#ifdef UNIX
|
||||
|
|
Loading…
Reference in New Issue