On Mon, Mar 3, 2014 at 3:53 AM, John Steele Scott <toojays@xxxxxxxxxxx> wrote: > > When comparing this to GCC's exception handling, I find that libstdc++ calls malloc() whenever an exception is thrown, and falls back to statically allocated memory only when malloc fails. Only 64 statically allocated exceptions may be in flight at once, and if this limit is violated, std::terminate() is called. > > This seems like quite a brittle behaviour to me. I guess not often seen as a problem in practice because Linux overcommit usually ensures malloc() won't fail (although if it does, then you have to take your chances with the oom-killer anyway). > > There doesn't seem to be any way around this, is there? Do GCC developers consider it a bug? If you have a good proposal for how to handle this situation, I'm sure that GCC developers would consider it. It seems pretty tough to handle large numbers of exceptions when malloc fails. And since it is such an unusual condition, I don't think it would be a good idea to address it in a manner that penalizes performance in ordinary conditions. Ian