Runtime error in map

  • Hi,

    I am getting a run time error in creating a map as shown in test_map_random.cpp in windows.

    I'd like to know where I might be lacking or what is wrong with how I am using the map.

    Here is the stack trace:
    Stxxl.exe!std::list<unsigned int,std::allocator<unsigned int> >::splice(std::list<unsigned int,std::allocator<unsigned int> >::_Iterator<1> _Where=0, std::list<unsigned int,std::allocator<unsigned int> > & _Right=(0,1,2), std::list<unsigned int,std::allocator<unsigned int> >::_Iterator<1> _First=2)  Line 869 + 0x1c bytes C++
    Stxxl.exe!stxxl::btree::node_cache<stxxl::btree::normal_leaf<int,int,cmp,4096,stxxl::btree::btree<int,int,cmp,4096,4096,stxxl::SR> >,stxxl::btree::btree<int,int,cmp,4096,4096,stxxl::SR> >::get_new_node(stxxl::BID<4096> & new_bid={…})  Line 262 C++
    Stxxl.exe!stxxl::btree::btree<int,int,cmp,4096,4096,stxxl::SR>::create_empty_leaf()  Line 226 + 0x1f bytes C++
    Stxxl.exe!stxxl::btree::btree<int,int,cmp,4096,4096,stxxl::SR>::btree<int,int,cmp,4096,4096,stxxl::SR>(unsigned int node_cache_size_in_bytes=4202489, unsigned int leaf_cache_size_in_bytes=4202489)  Line 418 C++
    Stxxl.exe!main(int argc=, char * * argv=)  Line 17 + 0xa bytes C++
    Stxxl.exe!__tmainCRTStartup()  Line 597 + 0x17 bytes C

    This is the code I am running:

    #include <stxxl/map>

    struct cmp : std::less<int> {
    typedef int type_t;
    static type_t max_value() {
    return (std::numeric_limits<type_t>::max)();

    #define NODE (4096)
    #define LEAF (4096)
    typedef stxxl::map<int, int, cmp, NODE, LEAF> xxl_map_type;
    #define NODE_BLOCK_SIZE xxl_map_type::node_block_type::raw_size
    #define LEAF_BLOCK_SIZE xxl_map_type::leaf_block_type::raw_size

    int main(int argc, char**argv) {
    xxl_map_type m(NODE_BLOCK_SIZE*4, LEAF_BLOCK_SIZE*3);
    return 0;

    compile options:
    -I"<path>stxxl-1.3.1"/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE /O2 /Ob2 /MD /DNDEBUG -D_RTLDLL -DBOOST_LIB_DIAGNOSTIC -DSTXXL_BOOST_TIMESTAMP -DSTXXL_BOOST_CONFIG -DSTXXL_BOOST_FILESYSTEM -DSTXXL_BOOST_THREADS -DSTXXL_BOOST_RANDOM -I<path>\boost\1_39_0 /EHsc /EHs /wd4820 /wd4217 /wd4668 /wd4619 /wd4625 /wd4626 /wd4355 /wd4996 -D_SCL_SECURE_NO_DEPRECATE /F 16777216 /nologo

    linker options:
    LIBPATH:"<path>\stxxl-1.3.1"<path>\ libstxxl.lib /LIBPATH:<path>\boost\1_39_0\lib\ /STACK:16777216 /NOLOGO /OPT:REF

    Thanks in advance,


  • Hi,

    I can't reproduce the problem under Linux.

    Could you try the latest version of stxxl from SVN trunk and a more current version of Boost?


  • Hi Andreas,

    Thanks for your reply. I did try using the trunk version and boost 1.48. I am getting the same error.  I havent tried working on linux though.

  • Hi Andreas,

    I did tried running the same code in Ubuntu and works, the error is only on my win32 machine.It might be with the environment,  if anyone is able to use the map in windows without error kindly post…