LibCds: Michael Hashmap and Split Order List

I am using libcds and they have an implementation of Michael Hash Map and Split order list.

Based on the information I gathered from the doc here is how I implemented them:

ncludes:
1
2
3
#include <cds/map/michael_hash_map.h>
#include <cds/map/split_ordered_list.h>
using namespace cds;

Code:
1
2
3
4
5
6
7
8
9
10
11
12
  class TestDs {
public:
    virtual bool containsKey(int key)=0;
    virtual int get(int key)=0;
    virtual int put(int key, int value)=0;
    virtual int remove(int key)=0;

    virtual int size()=0;
    virtual const char* name()=0;
    virtual void print()=0;
    virtual void shutdown()=0;
};

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class Michael: public TestDs{
private:

    cds::map::MichaelHashMap<int,int,cds::map::pair_traits <int, int>, cds::map::type_traits, CDS_DEFAULT_ALLOCATOR> _ds;
public:
        Michael(const Configuration& config) : _ds(config.initial_count,config.load_factor) {
        }

    bool containsKey(int key) {
        return (_ds.find(key)!=0);
    }

    int get(int key) {
        return _ds.find(key);
    }

    int put(int key, int value) {
        return _ds.insert(key,value);
    }

    int remove(int key) {
        return _ds.erase(key);
    }

    int size() {
        return _ds.size();
    }
    const char* name() {
        return "Micheal";
    }
    void print() {}
    void shutdown() {}

};

And:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class CDSSplit: public TestDs{
private:
    cds::map::SplitOrderedList<int,int,cds::map::pair_traits<int,int> ,cds::map::split_list::type_traits,CDS_DEFAULT_ALLOCATOR> _ds;
public:
    CDSSplit(const Configuration& config) : _ds(config.initial_count, config.load_factor) {
    }

    bool containsKey(int key) {
        return (_ds.find(key)!=0);
    }

    int get(int key) {
        return _ds.find(key);
    }

    int put(int key, int value) {
        return _ds.insert(key,value);
    }

    int remove(int key) {
        return _ds.erase(key);
    }

    int size() {
        return _ds.size();
    }
    const char* name() {
        return "CDSSPlit";
    }
    void print() {}
    void shutdown() {}

};

I initiate the structures by calling:

1
2
TestDs* _gTestDs1 = new Michael(_gConfiguration);
TestDs* _gTestDs2 = new CDSSplit(_gConfiguration);

However I get segmentation faults, when CDSSplit is initiated, or when Michael has its first insert performed.

The Library installed fine with no warnings, and I use other hashtables I don't get any errors.

Error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Program received signal SIGSEGV, Segmentation fault.
cds::ordered_list::details::michael_list::implementation<cds::gc::hzp_gc,
cds::ordered_list::details::michael_list::adapter<cds::gc::hzp_gc,
cds::map::split_list::details::regular_key<int, unsigned int>, int,
cds::map::split_list::details::split_list_base<int, int,
cds::map::pair_traits<int, int>, cds::map::split_list::type_traits,
std::allocator<int> >::ordlist_pair_traits,
cds::ordered_list::split_list::details::michael_list_hzp_type_selector<cds::map::split_list::details::regular_key<int, unsigned int>,
cds::map::split_list::details::dummy_key<unsigned int>, int,
cds::map::split_list::details::split_list_base<int, int, cds::map::pair_traits<int, int>, cds::map::split_list::type_traits, std::allocator<int> >::ordlist_pair_traits,
cds::map::split_list::details::split_list_base<int, int,
 cds::map::pair_traits<int, int>, cds::map::split_list::type_traits,
std::allocator<int> >::ordered_list_traits, std::allocator<int> >::type_traits,
std::allocator<int> >, std::allocator<int> >::insert (this=0x8420088, refHead=...,     pNode=0x8430060)

at /usr/include/cds/ordered_list/details/michael_list_hpgen.h:457
457	            position pos( gc_base_class::getGC() )  ;


Thanks for any help

(Cross Posting due to lack of interest/views (http://stackoverflow.com/questions/6632234/libcds-michael-hashmap-and-split-order-list)
Last edited on
Topic archived. No new replies allowed.