everyone!
I'm using NTL inside the SGX enclave. When I run the application, I got the issue about out of memory
. Then I checked the memory, I guess it's due to the heavy use of the NTL matrix.
The basic use of matrix in NTL:
Mat<size_t> mtemp;
mtemp.SetDims(num_row, num_col);
In NTL matrix.cpp, I didn't find any function to free memory.
For kill()
, the implementation is about swap()
:
template<class T>
void Mat<T>::kill()
{
Mat<T> tmp;
this->swap(tmp);
}
void swap(Mat& other)
{
_mat__rep.swap(other._mat__rep);
_ntl_swap(_mat__numcols, other._mat__numcols);
}
template<class T>
void _ntl_swap(T*& a, T*& b)
{
T* t = a; a = b; b = t;
}
This cannot help free the memory of the matrix. How can I free memory after the use?