I have a uBLAS matrix, like so:
boost::numeric::ublas::matrix<double> mat(50000,50000);
Once I'm done with a set of calculations on the matrix, I want its memory freed.
I have been using mat.clear()
which, according to the docs, "clears the matrix". But my program keeps running out of memory.
Digging into the headers, I find this:
void clear () {
std::fill (data ().begin (), data ().end (), value_type/*zero*/());
}
So there's a clear semantics problem with clear()
.
The question then is, how do I ensure that the memory is freed?