Question

We have a test in our code that tries to tickle a stack-overflow bug (in an old modified version of OpenCV). AFAIK, the test should SEGV if there is actually a stack overflow.

One of our users is getting a test failure because of exception std::bad_alloc thrown. It sounds like this exception is only thrown for heap allocations (results of new operator - http://www.cplusplus.com/reference/std/new/bad_alloc/).

Could this be happening because of a large stack allocation?

For reference, the test is: http://code.google.com/p/modpagespeed/source/browse/trunk/src/net/instaweb/rewriter/image_test.cc#826

and the bug report is: http://code.google.com/p/modpagespeed/issues/detail?id=528

Was it helpful?

Solution

No, this exception is thrown only from operator new/new[].

It could happen even if you don't use operator new/new[] anywhere - the reason - STL containers do use it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top