You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a MEX interface to use CLP in MATLAB and have the following (should-be) equivalent code, that links dynamically agains the official pre-built Clp.dll v1.17.6:
This code is running fine and as expected on Linux and MacOS. On Windows, this code causes Access Violation in the lines with delete[] status. Or, better, it does not crash if I allow the memory leak and comment out the delete[] status lines:
Now, I remember from a different project that we got Access Violations when writing to global parameters in a different DLL. I understand that according to this MSVC doc article, any access to data from a DLL is forbidden. In my understanding that should include delete[]ing pointers allocated by said DLL.
I think calling delete[] on the return array from statusCopy is wrong as a concept. Maybe one of the following should help?
return a std::vector from ClpSimple::statusCopy
provide a function in ClpSimplex were the user can return the pointer
I haven't had a chance to look at this, but just wanted to point out that there is a free Matlab toolbox for interfacing to many of the COIN-OR solvers, including Clp: https://www.inverseproblem.co.nz/OPTI/.
The documentation for using warm start follows the example in
defaults.cpp
and goes like this:I am writing a MEX interface to use CLP in MATLAB and have the following (should-be) equivalent code, that links dynamically agains the official pre-built
Clp.dll
v1.17.6:This code is running fine and as expected on Linux and MacOS. On Windows, this code causes Access Violation in the lines with
delete[] status
. Or, better, it does not crash if I allow the memory leak and comment out thedelete[] status
lines:Now, I remember from a different project that we got Access Violations when writing to global parameters in a different DLL. I understand that according to this MSVC doc article, any access to data from a DLL is forbidden. In my understanding that should include
delete[]
ing pointers allocated by said DLL.I think calling
delete[]
on the return array fromstatusCopy
is wrong as a concept. Maybe one of the following should help?return a
std::vector
fromClpSimple::statusCopy
provide a function in
ClpSimplex
were the user can return the pointerThe text was updated successfully, but these errors were encountered: