Subject: [Boost-bugs] [Boost C++ Libraries] #8724: bad_alloc thrown in empty list copy constructor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-24 18:36:37
#8724: bad_alloc thrown in empty list copy constructor
------------------------------+--------------------------
Reporter: gleonid@⦠| Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.53.0 | Severity: Problem
Keywords: |
------------------------------+--------------------------
I am running RHEL 5.[[BR]]
Compiler - gcc 4.1.2[[BR]]
following code fragment compiled against boost 1.53.0 throws bad_alloc
exception at run time.[[BR]]
Essentially I have an empty ::boost::container::list object allocated in
shared memory (segment_manager from boost interprocess).
attempt to copy such empty list causes bad_alloc exception
{{{
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_external_buffer.hpp>
namespace
{
typedef ::boost::interprocess::allocator<int,
::boost::interprocess::managed_external_buffer::segment_manager>
int_allocator;
typedef ::boost::container::list<int, int_allocator> int_list;
char g_memory_buf[1024];
}
int main()
{
::boost::interprocess::managed_external_buffer
segment(::boost::interprocess::create_only, g_memory_buf,
sizeof(g_memory_buf));
// 1. construct empty list
int_list *l1 =
segment.construct<int_list>("1")(int_allocator(segment.get_segment_manager()));
// 2. use copy constructor
segment.construct<int_list>("2")(*l1);
return 0;
}
}}}
when same code is compiled against boost 1.51.0 - no exceptions.
I wonder if this behavioral change was intentional.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8724> 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:13 UTC