Boost logo

Boost Users :

Subject: Re: [Boost-users] why is make_shared using so much of my stack....?
From: Michael Xu (mx2323_at_[hidden])
Date: 2011-02-06 12:02:19


I checked my little example above...

It's actually using 2 gb on the stack... plus 1 gb on the heap.

Both frame 0 and frame 1 seem to have 1gb.

On Sun, Feb 6, 2011 at 7:16 AM, Krzysztof Czainski <1czajnik_at_[hidden]>wrote:

> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Michael Xu
(770)634-1738
Computer Science
Georgia Tech


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