Reputation: 69
I have the following code which is a pretty simple test, but the VS refuses to run it:
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);
the program produces a runtime error in a memory location in the 3rd line . What am I doing wrong? I'm compiling the program for 64-bit platforms. In the Debug mode if I press continue the program resumes and executes without problem.
Upvotes: 1
Views: 121
Reputation: 283
Consider the following example:
#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;
}
An error can easily be provoked when there is not enough space left on the device. Can you post your runtime error?
Upvotes: 0