diff options
Diffstat (limited to 'libstdc++-v3/libsupc++/eh_alloc.cc')
-rw-r--r-- | libstdc++-v3/libsupc++/eh_alloc.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index 4728bcbf380..e43b0790c43 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -77,6 +77,14 @@ using namespace __cxxabiv1; # define EMERGENCY_OBJ_COUNT 4 #endif +/* APPLE LOCAL begin reduce emergency buffer size */ +/* 256 bytes is more than large enough for an std::bad_alloc object */ +#undef EMERGENCY_OBJ_SIZE +#undef EMERGENCY_OBJ_COUNT +#define EMERGENCY_OBJ_SIZE 256 +#define EMERGENCY_OBJ_COUNT 2 +/* APPLE LOCAL end reduce emergency buffer size */ + #if INT_MAX == 32767 || EMERGENCY_OBJ_COUNT <= 32 typedef unsigned int bitmask_type; #else @@ -147,6 +155,12 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) throw() std::terminate (); } + // We have an uncaught exception as soon as we allocate memory. This + // yields uncaught_exception() true during the copy-constructor that + // initializes the exception object. See Issue 475. + __cxa_eh_globals *globals = __cxa_get_globals (); + globals->uncaughtExceptions += 1; + memset (ret, 0, sizeof (__cxa_exception)); return (void *)((char *)ret + sizeof (__cxa_exception)); |