Boost logo

Boost Users :

Subject: Re: [Boost-users] why is make_shared using so much of my stack....?
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2011-02-06 07:16:17


2011/2/6 Christopher Jefferson <chris_at_[hidden]>

>
> boost::detail::sp_ms_deleter<test>
>
> Is as big as test, and make_shared allocates one of those on the stack, in
> line:
>
> boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T
> >() );
>
> Chris

This looks like a very interesting drawback of make_shared, that never
occoured to me. The deleter contains space for the allocated object inside
itself, and is passed by value, therefore the allocated object must be small
enough to fit on the stack, when using make_shared.

Is this a known thing (bug)?

Regards, Kris.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net