简体   繁体   English

内存泄漏与特征稀疏矩阵乘法

[英]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. 我用“setFromTriplets”设置L并将W设置为单位矩阵。

Now I want to do: 现在我想做:

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

(Although I know it's going to give me L back). (虽然我知道它会给我L回来)。

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. 即使我最后删除了矩阵(我也尝试过调整大小(0,0)),但由于这种乘法,我遇到了严重的内存泄漏。

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. 但它并非源自那里......对不起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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