
Hi everyone, I've been investigating our program's memory usage, and one of the spots that I keep seeing the stack hitting its limit is when using boost::make_shared. I've written a simple test program, that completes fine when I use new... but fails with a stack overflow when I use boost::make_shared ======================== #include <iostream> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> using namespace std; struct arr { char arg[1024*1024]; }; struct test { struct arr array[1024]; }; int main() { test * myTest = new test(); //complete! if (!myTest) cout << "new alloc failed"; boost::shared_ptr<test> testPtr = boost::make_shared<test>(); //fails with stack overflow! if (!testPtr) { cout << "alloc failed;"; } } =========================== If you run this with a reasonable thread stack of 8 megabytes, it fails when using boost::make_shared. Here is the stack trace..... #0 boost::shared_ptr<test>::shared_ptr<test, boost::detail::sp_ms_deleter<test> >(test*, boost::detail::sp_ms_deleter<test>) () #1 boost::shared_ptr<test> boost::make_shared<test>() () #2 main () Is there a reason this happens? Thanks michael