필터 지우기
필터 지우기

cleaning functions in MEX files

조회 수: 5 (최근 30일)
Cédric Devivier
Cédric Devivier 2011년 9월 3일
Dear all,
I have some issues with MATLAB cleaning functions in MEX files. In the link below is a zip file containing the c++ code, some data to test it and a m file to build it and run it.
I was able to compile it under linux before but from a system upgrade it won't anymore. I narrowed the problem down to the cleaning part when returning to windows but my knowledge in c++ stops here. I didn't wrote the code myself (I adapted it for matlab and the large arrays dim).
Thank you for your help,
Cédric
  댓글 수: 2
Olaf
Olaf 2011년 10월 19일
Hi Cédric,
Have you solved the problem already? If not, can you provide an example you would call mf2 from the Matlab prompt? What exactly did you mean by the "cleaning part"?
Olaf
Cédric Devivier
Cédric Devivier 2011년 10월 20일
Hi Olaf,
I have not solved this issue yet.
If you download and unzip the mf2.zip file, open the compile.m file in the mf2 folder newly created.
You will see issues if not after the first run, run again 'cutsideg = mf2(sourcesinkg,remaing);' a couple of times.
"The cleaning part" means when the mex file is exiting and returning to MATLAB. I used valgrind and gdb and it didn't find any errors, but when I run the same mexa64 compiled file, it crashes.
Thanks for your help,
Cédric

댓글을 달려면 로그인하십시오.

채택된 답변

Cédric Devivier
Cédric Devivier 2012년 9월 7일
편집: Cédric Devivier 2012년 9월 7일
This problem has been solved in the comments of this file:

추가 답변 (1개)

Jan
Jan 2011년 10월 19일
This will fail if the input is a DOUBLE array:
float *sourcesinkVal;
sourcesinkVal = (float *) mxGetPr(prhs[0]);
Better use:
float *sourcesinkVal;
if (!mxIsSingle(prhs[0])) {
mexErrMsgTxt("1st input must be a SINGLE.");
}
sourcesinkVal = (float *) mxGetData(prhs[0]);
It is not clear where the function crashs. Please post more details.
  댓글 수: 1
Cédric Devivier
Cédric Devivier 2011년 10월 20일
Hi Jan,
Thanks for your remark, I added the same for the second input.
As I said to Olaf, MATLAB crashes when I run it. And from the crash dump, the begining looks like:
Abnormal termination:
Abort signal
In my understanding, this routine does not clean properly the variables it created. Also sometimes, I have an error like that:
"glibc detected *** corrupted double-linked list"
Thanks for your help,
Cédric

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by