00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <sys/types.h>
00024
00025 #include <new>
00026
00027 #include "Basics.H"
00028
00029 Basics::gc_no_pointers_t Basics::gc_no_pointers;
00030
00031
00032
00033
00034 void *operator new(size_t size, Basics::gc_no_pointers_t unused,
00035 const char *file, unsigned int line)
00036 {
00037 void *result;
00038 try
00039 {
00040 result = ::operator new(size);
00041 }
00042 catch (std::bad_alloc)
00043 {
00044 std::cerr << "Out of memory trying to allocate "
00045 << size << " bytes at "
00046 << file << ":" << line << std::endl;
00047 abort();
00048 }
00049 return result;
00050 }
00051
00052 void *operator new[](size_t size, Basics::gc_no_pointers_t unused,
00053 const char *file, unsigned int line)
00054 {
00055 void *result;
00056 try
00057 {
00058 result = ::operator new[](size);
00059 }
00060 catch (std::bad_alloc)
00061 {
00062 std::cerr << "Out of memory trying to allocate "
00063 << size << " bytes at "
00064 << file << ":" << line << std::endl;
00065 abort();
00066 }
00067 return result;
00068 }
00069
00070 void *operator new(size_t size, const char *file, unsigned int line)
00071 {
00072 void *result;
00073 try
00074 {
00075 result = ::operator new(size);
00076 }
00077 catch (std::bad_alloc)
00078 {
00079 std::cerr << "Out of memory trying to allocate "
00080 << size << " bytes at "
00081 << file << ":" << line << std::endl;
00082 abort();
00083 }
00084 return result;
00085 }
00086
00087 void *operator new[](size_t size, const char *file, unsigned int line)
00088 {
00089 void *result;
00090 try
00091 {
00092 result = ::operator new[](size);
00093 }
00094 catch (std::bad_alloc)
00095 {
00096 std::cerr << "Out of memory trying to allocate "
00097 << size << " bytes at "
00098 << file << ":" << line << std::endl;
00099 abort();
00100 }
00101 return result;
00102 }
00103
00104
00105
00106 void operator delete(void *p) { }
00107 void operator delete[](void *p) { }