stxxl::vector with n pages and LRU replacement strategy, it can be guaranteed that the last n references obtained using stxxl::vector::operator[] or dereferencing an iterator are valid. However, if n is 1, even a single innocent-looking line like std::cout << v[0] << " " << v[1000000] << std::endl;
This is why stxxl::vector<std::vector<T> > and stxxl::vector<stxxl::vector<T> > are invalid. If appropriate, use std::vector<stxxl::vector<T> >, or emulate a two-dimensional array by doing index calculation.
STXXL data structures from concurrent threads without problems, but you should not share a data structure between threads (without implementing proper locking yourself).STXXL containers use randomized block-to-disk allocation strategies that distribute data evenly between the disks but ignore the availability of free space on them.Precondition: I use STXXL in a Microsoft CLR Library (a special DLL). That means that managed code and native code (e.g. STXXL) have to co-exist in your library.
Symptom: Application crashes at process exit, when the DLL is unloaded.
Cause: STXXL's singleton classes use the atexit() function to destruct themselves at process exit. The exit handling will cause the process to crash at exit (still unclear if it's a bug or a feature of the MS runtime).
Solution:
1.) Compiled STXXL static library with STXXL_NON_DEFAULT_EXIT_HANDLER defined.
2.) For cleanup, stxxl::run_exit_handlers() has now to be called manually. To get this done automatically:
Defined a CLI singleton class "Controller":
public ref class Controller {
private:
static Controller^ instance = gcnew Controller;
Controller();
};
Registered my own cleanup function in Controller's constructor which will manage to call stxxl::run_exit_handlers():
#pragma managed(push, off)
static int myexitfn()
{
stxxl::run_exit_handlers();
return 0;
}
#pragma managed(pop)
Controller::Controller()
{
onexit(myexitfn);
}
1.5.6