
"Chris Newbold" <Chris.Newbold@mathworks.com> wrote in message news:6F6A2FC198A0F943ACC2259C38A2E30B6B6FB4BD9E@EXCHANGE-AH.ad.mathworks.com...
From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Chris Newbold Sent: Wednesday, October 01, 2008 7:58 AM
With your latest updates to the shifted_ptr code I've been able to compile w/ GCC 4.1.2 and reproduce a crash; it looks a little different than the one you posted, but at least now I've got something to dig into. Stay tuned.
Phil--
I believe that this crash is actually a bug in your code. In boost::detail::sh::pool::allocate you are dividing the specified size by the pool's chunk size. However, in deallocate, you are just passing the size directly to the underlying pool. The result is that you are trying to free twice as many chunks as you allocated.
Take a look and let me know what you think.
My mistake. I forgot taking the chunk_size_ away and relying on array of chars. Now here is the crash I got: #0 0x0041ca66 in boost::simple_segregated_storage<unsigned int>::try_malloc_n (start=@0x22fcdc, n=16, partition_size=4) at simple_segregated_storage.hpp:234 #1 0x0041cb58 in boost::simple_segregated_storage<unsigned int>::malloc_n (this=0x48d030, n=17, partition_size=4) at simple_segregated_storage.hpp:256 #2 0x00420a4d in boost::pool<boost::default_user_allocator_new_delete>::ordered_malloc (this=0x48d030, n=68) at pool.hpp:511 #3 0x004238c9 in boost::detail::sh::pool::allocate (this=0x48d030, s=68) at sh_owned_base_nt.hpp:103 #4 0x0042a3fa in boost::detail::sh::shifted<std::_List_node<boost::detail::sh::shifted_ptr<vector>, boost::detail::sh::shifted_allocator<boost::detail::sh::shifted_ptr<vector>
::operator new (s=68) at sh_owned_base_nt.hpp:213 #5 0x00423202 in boost::detail::sh::shifted_allocator<std::_List_node<boost::detail::sh::shifted_ptr<vector>, boost::detail::sh::shifted_allocator<boost::detail::sh::shifted_ptr<vector> ::allocate (this=0x3e2d6c, s=1) at shifted_allocator.hpp:83 #6 0x00452436 in std::_List_base<boost::detail::sh::shifted_ptr<vector>, boost::detail::sh::shifted_allocator<boost::detail::sh::shifted_ptr<vector> ::_M_get_node (this=0x3e2d6c) at stl_list.h:333 #7 0x00463124 in std::list<boost::detail::sh::shifted_ptr<vector>, boost::detail::sh::shifted_allocator<boost::detail::sh::shifted_ptr<vector> ::_M_create_node (this=0x3e2d6c, __x=@0x22ff24) at stl_list.h:457 #8 0x004631e0 in std::list<boost::detail::sh::shifted_ptr<vector>, boost::detail::sh::shifted_allocator<boost::detail::sh::shifted_ptr<vector> ::_M_insert (this=0x3e2d6c, __position={_M_node = 0x3e2da0}, __x=@0x22ff24) at stl_list.h:1187 #9 0x00463218 in std::list<boost::detail::sh::shifted_ptr<vector>, boost::detail::sh::shifted_allocator<boost::detail::sh::shifted_ptr<vector> ::push_back (this=0x3e2d6c, __x=@0x22ff24) at stl_list.h:808 #10 0x004016e6 in main () at shifted_ptr_test2.cpp:102
-Phil