简体   繁体   中英

Memory leak with Eigen sparse matrices multiplication

I have these three sparse matrices, defined in the following way:

typedef SparseMatrix<double> SpMat;

int m_totSize = 256*256;

SpMat *L = new SpMat(m_totSize, m_totSize);
SpMat *A = new SpMat(m_totSize, m_totSize);     
SpMat *W = new SpMat(m_totSize, m_totSize);

I am setting L with "setFromTriplets" and set W as the identity matrix.

Now I want to do:

*A = (*W)*(*L);

(Although I know it's going to give me L back).

And then:

delete L;
delete A;
delete W;

Even though I'm deleting the matrices at the end (I've also tried resize(0,0)), I'm experiencing severe memory leaks because of this multiplication.

Any ideas?

Thanks!

It seems the memory leak originates from another part of my application, and the multiplication is the final straw (in terms of memory consumption). But it does not originate from there... sorry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM