STXXL磁盘分配错误Windows7

时间:2014-02-17 15:34:49

标签: c++ visual-studio-2012 memory-management stxxl

我正在尝试在Windows 7中使用stxxl - MSVC12 Express。

  1. 如果我不提供配置文件(.stxxl.txt):程序由

    启动

    [STXXL-MSG] STXXL v1.4.0(预发布/) [STXXL-ERRMSG]警告:未找到配置文件。 [STXXL-ERRMSG]使用默认磁盘配置。 [STXXL-MSG]已分配磁盘'C:\ Users \ Owner \ AppData \ Local \ Temp \ stxxl.tmp',spa ce:1000 MiB,I / O实现:wincall autogrow delete_on_exit queue = 0

    但是在它抛出错误之前会经历一个很长的循环 -

    “Microsoft C ++异常:内存位置0x0028DF50处的std :: bad_alloc”

  2. 如果我在'disk = c:/stxxl.tmp,4G,wincall delete'条目中包含配置文件(.stxxl.txt):我收到错误

    [STXXL-MSG] STXXL v1.4.0(预发布/) [STXXL-MSG]路径上的CreateFile()错误= c:\ stxxl.tmp mode = 28,没有DI重试 RECT模式。 [STXXL-MSG]错误分配磁盘'c:\ stxxl.tmp',空间:3814 MiB,I / O工具 ation:wincall delete_on_exit queue = 0

  3. 其他信息:

    一个。

    我使用的标头中只有stxxl特定信息是:       #include

    湾它没有命中主 - 因为我在那里的第一行放了一个断点。

  4. 我试图通过在具有4 GB内存的Windows m / c上运行来学习这一点。我是新来的,你能帮忙吗?

    先谢谢。

    14年2月23日: 下面是一个示例,其中包含STXXL的test_vector示例中的声明(我的声明导致错误被添加到STXXL的test_vector.cpp中,效果很好。这甚至在它进入main之前就会出现错误。当我声明'vector E'时会发生这种情况'在代码中。

     /***************************************************************************
     *  tests/containers/test_vector.cpp
     *
     *  Part of the STXXL. See http://stxxl.sourceforge.net
     *
     *  Copyright (C) 2002, 2003, 2006 Roman Dementiev <dementiev@mpi-sb.mpg.de>
     *  Copyright (C) 2010 Johannes Singler <singler@kit.edu>
     *
     *  Distributed under the Boost Software License, Version 1.0.
     *  (See accompanying file LICENSE_1_0.txt or copy at
     *  http://www.boost.org/LICENSE_1_0.txt)
    
     * MODIFIED A BIT BY ME TO INDICATE MY PROBLEM
     **************************************************************************/
    
    //! \example containers/test_vector.cpp
    //! This is an example of use of \c stxxl::vector and
    //! \c stxxl::VECTOR_GENERATOR. Vector type is configured
    //! to store 64-bit integers and have 2 pages each of 1 block
    
           #include <iostream>
           #include <algorithm>
           #include <stxxl/vector>
           #include <stxxl/scan>
    
    //the includes that are not showing properly are iostream, algorithm, stxxl/vector and stxxl/scan
    
    // I added code till I indicate that again with comment  
    
        struct R1 {
                float S1;    
            float S2;   
            float S3;            
            float S4;   
            float S5;           
            char S6[2]; 
            float S7;
            char S8[15];
            double S9; 
            }; 
    
        struct G11{
    
        float A; 
        float B;           
        float C; 
        float D;           
        stxxl::vector<R1> R;
        }; 
    
         struct E1{
        char S11[80];
        int N11;
        stxxl::vector<G11> G; 
         }; 
    
            typedef stxxl::VECTOR_GENERATOR<E1>::result vector;
            vector E;
    
    //finish elements I added above where the error is
    
          struct element  // 24 bytes, not a power of 2 intentionally
          {
        stxxl::int64 key;
        stxxl::int64 load0;
        stxxl::int64 load1;
    
        element& operator = (stxxl::int64 i)
        {
            key = i;
            load0 = i + 42;
            load1 = i ^ 42;
            return *this;
        }
    
        bool operator == (const element& e2) const
        {
            return key == e2.key && load0 == e2.load0 && load1 == e2.load1;
        }
        };
    
        struct counter
        {
           int value;
           counter(int v) : value(v) { }
           int operator () ()
        {
            int old_val = value;
            value++;
            return old_val;
        }
        };
    
        template <class my_vec_type>
        void test_const_iterator(const my_vec_type& x)
        {
        typename my_vec_type::const_iterator i = x.begin();
        i = x.end() - 1;
        i.block_externally_updated();
        i.flush();
        i++;
        ++i;
        --i;
        i--;
        *i;
        }
    
        void test_vector1()
         {
          // use non-randomized striping to avoid side effects on random generator
        typedef stxxl::VECTOR_GENERATOR<element, 2, 2, (1024* 1024), stxxl::striping>::result vector_type;
        vector_type v(32 * 1024 * 1024 / sizeof(element));
    
        // test assignment const_iterator = iterator
        vector_type::const_iterator c_it = v.begin();
        STXXL_UNUSED(c_it);
    
        unsigned int big_size = 2 * 32 * 1024 * 1024;
        typedef stxxl::vector<double> vec_big;
        vec_big my_vec(big_size);
    
        vec_big::iterator big_it = my_vec.begin();
        big_it += 6;
    
        test_const_iterator(v);
    
        stxxl::random_number32 rnd;
        int offset = rnd();
    
        STXXL_MSG("write " << v.size() << " elements");
    
        stxxl::ran32State = 0xdeadbeef;
        vector_type::size_type i;
    
        // fill the vector with increasing sequence of integer numbers
        for (i = 0; i < v.size(); ++i)
        {
            v[i].key = i + offset;
            STXXL_CHECK(v[i].key == stxxl::int64(i + offset));
        }
    
    
        // fill the vector with random numbers
        stxxl::generate(v.begin(), v.end(), stxxl::random_number32(), 4);
        v.flush();
    
        STXXL_MSG("seq read of " << v.size() << " elements");
    
        stxxl::ran32State = 0xdeadbeef;
    
        // testing swap
        vector_type a;
        std::swap(v, a);
        std::swap(v, a);
    
        for (i = 0; i < v.size(); i++)
            STXXL_CHECK(v[i].key == rnd());
    
        // check again
        STXXL_MSG("clear");
    
        v.clear();
    
        stxxl::ran32State = 0xdeadbeef + 10;
    
        v.resize(32 * 1024 * 1024 / sizeof(element));
    
        STXXL_MSG("write " << v.size() << " elements");
        stxxl::generate(v.begin(), v.end(), stxxl::random_number32(), 4);
    
        stxxl::ran32State = 0xdeadbeef + 10;
    
        STXXL_MSG("seq read of " << v.size() << " elements");
    
        for (i = 0; i < v.size(); i++)
            STXXL_CHECK(v[i].key == rnd());
    
        STXXL_MSG("copy vector of " << v.size() << " elements");
    
        vector_type v_copy0(v);
        STXXL_CHECK(v == v_copy0);
    
        vector_type v_copy1;
        v_copy1 = v;
        STXXL_CHECK(v == v_copy1);
        }
    
    //! check vector::resize(n,true)
    
             void test_resize_shrink()
             {
        typedef stxxl::VECTOR_GENERATOR<int, 2, 4, 4096>::result vector_type;
        vector_type vector;
    
        int n = 1 << 16;
        vector.resize(n);
    
        for (int i = 0; i < n; i += 100)
            vector[i] = i;
    
        vector.resize(1, true);
        vector.flush();
        }
    
            int main()
        {
        test_vector1();
        test_resize_shrink();
    
        return 0;
        }
    
    // forced instantiation
    
                    template struct stxxl::VECTOR_GENERATOR<element, 2, 2, (1024* 1024), stxxl::striping>;
        template class stxxl::vector<double>;
        template class stxxl::vector_iterator<double, STXXL_DEFAULT_ALLOC_STRATEGY,          stxxl::uint64, stxxl::int64, STXXL_DEFAULT_BLOCK_SIZE(double), stxxl::lru_pager<8>, 4>;
        template class stxxl::const_vector_iterator<double, STXXL_DEFAULT_ALLOC_STRATEGY,      stxxl::uint64, stxxl::int64, STXXL_DEFAULT_BLOCK_SIZE(double), stxxl::lru_pager<8>, 4>;
    
    //-tb bufreader instantiation work only for const_iterator!
    
            typedef stxxl::vector<double>::const_iterator const_vector_iterator;
        template class stxxl::vector_bufreader<const_vector_iterator>;
        template class stxxl::vector_bufreader_reverse<const_vector_iterator>;
        template class stxxl::vector_bufreader_iterator<stxxl::vector_bufreader<const_vector_iterator> >;
    
        typedef stxxl::vector<double>::iterator vector_iterator;
        template class stxxl::vector_bufwriter<vector_iterator>;
    

0 个答案:

没有答案