[Boost-bugs] [Boost C++ Libraries] #4256: boost::make_shared() may issue stack overflow while constructing large objects

Subject: [Boost-bugs] [Boost C++ Libraries] #4256: boost::make_shared() may issue stack overflow while constructing large objects
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-05-25 11:03:31


#4256: boost::make_shared() may issue stack overflow while constructing large
objects
----------------------------------------+-----------------------------------
 Reporter: faridz@… | Owner: pdimov
     Type: Bugs | Status: new
Milestone: Boost 1.44.0 | Component: smart_ptr
  Version: Boost 1.43.0 | Severity: Problem
 Keywords: make_shared stack overflow |
----------------------------------------+-----------------------------------
 By default stack size for windows executable is 1Mb. The program below
 fails with stack overflow exception. In debug builds the stack overflow
 exception issued with A_Size >= "stack size" / 3. In release builds due to
 optimizations, the stack overflow exception issued with A_Size >= "stack
 size" / 2.

 {{{
 #include <cstddef>
 #include <boost/make_shared.hpp>
 #include <boost/shared_ptr.hpp>

 const std::size_t A_Size = 512;

 struct A
 {
     char buf_[A_Size * 1024];
 };

 int main()
 {
     boost::shared_ptr<A> pa(boost::make_shared<A>());
     //boost::shared_ptr<A> pa(new A());

     return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4256>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC