robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
381 stars 112 forks source link

A bug happened at the end of MPC example program #134

Closed epiphanyKANG closed 1 year ago

epiphanyKANG commented 1 year ago

Hello,

Thanks for your C++ library. I got a problem when I run the MPC example on Visual Studio 2019.

Actually, I have got the right solutions for the MPC controller. However, the bug always happens at the end of the MPC program. Here are some illustrations.

The debug log:

HEAP[MPC_VS1.exe]: Invalid address specified to RtlValidateHeap( 00000274D9260000, 00000274D93137D0 )

The place of the breakpoint:

First: EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }

Called subprogram: template<typename T, bool Align> EIGEN_DEVICE_FUNC inline void conditional_aligned_delete_auto(T *ptr, std::size_t size) { if(NumTraits::RequireInitialization) destruct_elements_of_array(ptr, size); conditional_aligned_free(ptr); }

Called subprogram: /* \internal Frees memory allocated with conditional_aligned_malloc / template EIGEN_DEVICE_FUNC inline void conditional_aligned_free(void *ptr) { aligned_free(ptr); }

Called subprogram: /* \internal Frees memory allocated with aligned_malloc. / EIGEN_DEVICE_FUNC inline void aligned_free(void *ptr) {

if (EIGEN_DEFAULT_ALIGN_BYTES==0) || EIGEN_MALLOC_ALREADY_ALIGNED

std::free(ptr);

else

handmade_aligned_free(ptr);

endif

}