Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatched free fix #399

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions trajopt_sco/include/trajopt_sco/osqp_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class OSQPModel : public Model
ConstraintTypeVector cnt_types_; /**< constraints types */
DblVec solution_; /**< optimizizer's solution for current model */

std::unique_ptr<csc> P_; /**< Takes ownership of OSQPData.P to avoid having to deallocate manually */
std::unique_ptr<csc> A_; /**< Takes ownership of OSQPData.A to avoid having to deallocate manually */
std::vector<c_int> P_row_indices_; /**< row indices for P, CSC format */
std::vector<c_int> P_column_pointers_; /**< column pointers for P, CSC format */
DblVec P_csc_data_; /**< P values in CSC format */
Eigen::VectorXd q_; /**< linear part of the objective */
std::unique_ptr<csc, decltype(&free)> P_; /**< Takes ownership of OSQPData.P to avoid having to deallocate manually */
std::unique_ptr<csc, decltype(&free)> A_; /**< Takes ownership of OSQPData.A to avoid having to deallocate manually */
std::vector<c_int> P_row_indices_; /**< row indices for P, CSC format */
std::vector<c_int> P_column_pointers_; /**< column pointers for P, CSC format */
DblVec P_csc_data_; /**< P values in CSC format */
Eigen::VectorXd q_; /**< linear part of the objective */

std::vector<c_int> A_row_indices_; /**< row indices for constraint matrix, CSC format */
std::vector<c_int> A_column_pointers_; /**< column pointers for constraint matrix, CSC format */
Expand Down
2 changes: 1 addition & 1 deletion trajopt_sco/src/osqp_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Model::Ptr createOSQPModel(const ModelConfig::ConstPtr& config = nullptr)
return std::make_shared<OSQPModel>(config);
}

OSQPModel::OSQPModel(const ModelConfig::ConstPtr& config) : P_(nullptr), A_(nullptr)
OSQPModel::OSQPModel(const ModelConfig::ConstPtr& config) : P_(nullptr, free), A_(nullptr, free)
{
// tuning parameters to be less accurate, but add a polishing step
if (config != nullptr)
Expand Down
Loading