3 * - By John Hodge (thePowersGang)
10 #include <acess/sys.h>
14 extern "C" bool _libc_free(void *mem); // from libc.so, actual free.
17 void *operator new( size_t size )
19 //_SysDebug("libc++ - operator new(%i)", size);
20 return malloc( size );
23 void *operator new[]( size_t size )
25 //_SysDebug("libc++ - operator new[](%i)", size);
26 return malloc( size );
29 void operator delete(void *ptr)
31 if( !_libc_free(ptr) ) {
32 _SysDebug("delete of invalid by %p", __builtin_return_address(0));
33 throw ::std::bad_alloc();
37 void operator delete[](void *ptr)
39 if( !_libc_free(ptr) ) {
40 _SysDebug("delete[] of invalid by %p", __builtin_return_address(0));
41 throw ::std::bad_alloc();
46 ::std::bad_alloc::bad_alloc() noexcept
49 ::std::bad_alloc::~bad_alloc() noexcept
53 const char *::std::bad_alloc::what() const noexcept
55 return "allocation failure";