>Hi,
>Fractal wrote:
>> Hi all
>> rtree is a great library?I used it in my project, everything is ok except random crash after I updated program bin file.
>> i dig into the source code of rtree,found the crash was caused by using virtual function at node class. I also found that there is a static version of node class. is this a to be implement feature, or I'm using rtree in the wrong way?
>It's hard to tell not seeing exactly how the rtree is used.
>It would be helpful if you provided more information, e.g. answered
>these questions:
>Which version of Boost, compiler do you use and on which platform?
>What do you mean when you're saying "after I updated program bin file"?
>Had it been working before some change?
>Have you tried to clean your project and rebuild the program from scratch?
>Could you prepare some minimal crashing example?
>Is it possible that some other process is modifying the rtree/memory in
>the same time?
>Are you synchronising the access to the shared memory?
>Regards,
>Adam
here is the minimal example which exhibit the problem, you run the program the first time, is ok, but the second time, it crashed in insert method,
i'm using vs2012, and the os is win7, in linux version, i observed that only i recompile my program and restart it, will it crash.
#include <boost/interprocess/managed_mapped_file.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/geometry/index/indexable.hpp>
namespace bi = boost::interprocess;
namespace bg = boost::geometry;
namespace bgm = bg::model;
namespace bgi = bg::index;
int _tmain(int argc, _TCHAR* argv[])
{
typedef bi::managed_mapped_file managed_mapped_file_t;
typedef bgm::point<float, 2, bg::cs::cartesian> point_t;
typedef point_t rtree_value_type;
typedef bgi::linear<32, 8> params_t;
typedef bgi::indexable<rtree_value_type> indexable_t;
typedef bgi::equal_to<rtree_value_type> equal_to_t;
typedef bi::allocator<rtree_value_type, managed_mapped_file_t::segment_manager> rtree_allocator_t;
typedef bgi::rtree<rtree_value_type, params_t, indexable_t, equal_to_t, rtree_allocator_t> rtree_t;
managed_mapped_file_t file(bi::open_or_create, "d:\\a.bin", 1024*1024);
rtree_allocator_t alloc(file.get_segment_manager());
rtree_t* p_rtree = file.find_or_construct<rtree_t>("rtree")(params_t(), indexable_t(), equal_to_t(), alloc);
p_rtree->insert(point_t(1.0, 1.0)); // the second time run it, it will crash.
p_rtree->insert(point_t(2.0, 2.0));
p_rtree->remove(point_t(1.0, 1.0));
p_rtree->remove(point_t(2.0, 2.0));
return 0;
}