我有以下代码,这是一个非常简单的测试,但VS拒绝运行它:
stxxl::syscall_file OutputFile("Data/test.bin", stxxl::file::RDWR | stxxl::file::CREAT | stxxl::file::DIRECT);
typedef stxxl::VECTOR_GENERATOR<struct Rectangle, 8, 2, 524288>::result vector_type;
vector_type rects(&OutputFile);程序在第3行的内存位置产生运行时错误。我做错了什么?我正在为64位平台编译程序。在Debug模式下,如果我按下continue,程序将恢复并执行,没有任何问题。
发布于 2016-01-17 03:07:12
考虑以下示例:
#include <stxxl/io>
#include <stxxl/vector>
#include <iostream>
struct Rectangle {
int x;
Rectangle() = default;
};
int main() {
stxxl::syscall_file OutputFile("/tmp/test.bin", stxxl::file::RDWR |
stxxl::file::CREAT | stxxl::file::DIRECT);
typedef stxxl::VECTOR_GENERATOR<Rectangle, 8, 2, 524288>::result vector_type;
vector_type rects(&OutputFile);
Rectangle my_rectangle;
for (std::size_t i = 0; i < 1024 * 1024 * 1024; ++i)
rects.push_back(my_rectangle);
return 0;
}当设备上没有足够的空间时,很容易引发错误。你能发布你的运行时错误吗?
https://stackoverflow.com/questions/34801583
复制相似问题