My code seems to work (I have not tried it with large datasets due to the above error).
the code:
#include <iostream> #include <queue> #include <stxxl/queue> int main() { //queue<int> q; //this works stxxl::queue<int> q; //does not work for (int i = 0; i<100; i++) { q.push(i); } std::cout << "done copying" << std::endl; while (q.empty() == false) { std::cout << q.front() << std::endl; q.pop(); } std::cout << "done poping" << std::endl; return 0; }
my simple .stxxl
simple: disk=./testfile,0,syscall
But my mistake is:
stackexchangeexample(3884) malloc: *** error for object 0x101c04000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug The program has unexpectedly finished.
I'm not sure how to fix it, do I need to free up memory in this case? I'm still learning C ++, so sorry if this is really basic (this only happens when I use the stxxl queue).
source share