Open wyqsnddd opened 1 year ago
It is difficult to tell without having minimal code that triggers the issue. Are you doing multithreading by any chance?
Hi Vincent!
I am not using multi-threading. Maybe I can try to comment out the mutex
?
Or, I can try to construct Polyhedron
for two times in the test program
.
Hi Vincent,
I managed to call poly.setHrep(H, b)
for two times after commenting out the dd_FreePolyhedra(polytope_);
from the doubleDescription
:
bool Polyhedron::doubleDescription(const Eigen::MatrixXd& matrix, bool isFromGenerators)
{
initializeMatrixPtr(matrix.rows(), matrix.cols(), isFromGenerators);
for (auto row = 0; row < matrix.rows(); ++row)
for (auto col = 0; col < matrix.cols(); ++col)
matPtr_->matrix[row][col][0] = matrix(row, col);
// if (polytope_ != nullptr)
// dd_FreePolyhedra(polytope_);
polytope_ = dd_DDMatrix2Poly(matPtr_, &err_);
return (err_ == dd_NoError) ? true : false;
}
Would you mind looking at a customized example?
Hi Vincent,
It seems that I found a way to fix the issue with the minimum
changes: https://github.com/vsamy/eigen-cddlib/compare/master...wyqsnddd:eigen-cddlib:topic/memory-issue
Could you please take a look at it?
You are removing all the free functions, so you are basically leaking memory right now
Please provide a minimal code example so I can debug
Hi Samy, Thanks for the offer. I will try to come up with an example.
Hi Vincent!
I noticed an interesting issue recently. Following the test example, I wrapped
eigen-cddlib
'sPolyhedron
object in a function:vRepComdCone
. It worked fine if I call the function once. As long as I try to callvRepComdCone
consecutively, I got the following memory error:For completeness, I also attached the function I made: vRepComdCone.txt