I am getting an exception running C++ code generated by MATLAB Coder

4 ビュー (過去 30 日間)
Bernard Puc
Bernard Puc 2018 年 5 月 4 日
コメント済み: Rajanya 2024 年 9 月 23 日
The code that is failing is captured in the screen shot. Its an error occurring during a malloc() within the function emxInit_real_T().
void emxInit_real_T(emxArray_real_T **pEmxArray, int numDimensions)
{
emxArray_real_T *emxArray;
int i;
*pEmxArray = (emxArray_real_T *)malloc(sizeof(emxArray_real_T));
emxArray = *pEmxArray;
emxArray->data = (double *)NULL;
emxArray->numDimensions = numDimensions;
emxArray->size = (int *)malloc((unsigned int)(sizeof(int) * numDimensions));
emxArray->allocatedSize = 0;
emxArray->canFreeData = true;
for (i = 0; i < numDimensions; i++) {
emxArray->size[i] = 0;
}
}
  2 件のコメント
Benjamin
Benjamin 2024 年 9 月 12 日
I'm facing very similar problems. Did anyone found a solution or a reason for this?
In my case the malloc tries to access memory at a invalid adress.
Rajanya
Rajanya 2024 年 9 月 23 日
Can you share the MATLAB code which is throwing this error after generation?

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by