Error while debugging S-Function. (C MEX-Function)
1 次查看(过去 30 天)
显示 更早的评论
Hi, I am using a S-Function in Simulink to export data using Shared Memory. in which i am allocating memory in "mdlstart"
void mdlStart(SimStruct *S) {
TempCluster = malloc(sizeof(ARSCluster));
TempCluster_1 = malloc(sizeof(D));
TempCluster_2 = malloc(sizeof(D1));
TempCluster_3 = malloc(sizeof(D2));
TempCluster_4 = malloc(sizeof(D3));
TempCluster_5 = malloc(sizeof(D4));
TempCluster_6 = malloc(sizeof(D5));
}
And, i am de-allocating in "mdlTerminate" static void mdlTerminate(SimStruct *S) {
free(TempCluster);
free(TempCluster_1);
free(TempCluster_2);
free(TempCluster_3);
free(TempCluster_4);
free(TempCluster_5);
free(TempCluster_6);
}
In the process of debugging the S-Function, when i stop the simulation, the control goes to "mdlTerminate". When the control goes to "free()", i get the following error. ---------------------------------------------------------------------------------------------------------- "Windows has triggered a breakpoint in MATLAB.exe.
This may be due to a corruption of the heap, which indicates a bug in MATLAB.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while MATLAB.exe has focus.
The output window may have more diagnostic information." --------------------------------------------------------------------------------------------------------------
Kindly help me.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!