C mex s-function caused Segmentation violation to matlan crash
Show older comments
i am new on the C mex s-function. any help are appreciated.
The following C file is compiled OK, and the first time run in Simulink is Ok. but the third time simulation will cause a Segmentation violation.
The error message is
MATLAB crash file:C:\DOCUME~1\FM\LOCALS~1\Temp\matlab_crash_dump.5024:
------------------------------------------------------------------------
Segmentation violation detected at Fri Apr 13 19:52:37 2012
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.11.0.584 (R2010b)
MATLAB License: 161051
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 3)
Processor ID: x86 Family 6 Model 7 Stepping 10, GenuineIntel
Virtual Machine: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Default Encoding: windows-1252
Fault Count: 1
Abnormal termination:
Register State (captured):
EAX = 00000000 EBX = 78859114
ECX = 00c29904 EDX = 1fe8cd28
ESP = 00c29900 EBP = 00c29c14
ESI = 7888e74c EDI = 00c29bd4
EIP = 787f80a3 EFL = 00200246
CS = 0000001b DS = 8fc60023 SS = f71f0023
ES = 02120023 FS = 0000003b GS = 02750000
Stack Trace (captured):
[ 0] 0x787f80a3 C:/Program Files/MATLAB/R2010b/bin/win32/libmwfl.dll+00098467 ( fl::diag::stacktrace_base::format+005555 )
[ 1] 0x787f8453 C:/Program Files/MATLAB/R2010b/bin/win32/libmwfl.dll+00099411 ( fl::diag::terminate_log+000035 )
[ 2] 0x7a403f5c C:/Program Files/MATLAB/R2010b/bin/win32/mcr.dll+00278364 ( mnSetCmdLineArg+000636 )
[ 3] 0x78138e5f C:/WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86/MSVCR80.dll+00036447 ( XcptFilter+000335 )
[ 4] 0x0040687f C:/Program Files/MATLAB/R2010b/bin/win32/MATLAB.exe+00026751 ( ???+000335 )
[ 5] 0x7c817077 C:/WINDOWS/system32/kernel32.dll+00094327 ( RegisterWaitForInputIdle+000073 )
my c file is
i am new on the C mex s-function. any help are appreciated.
Answers (1)
Kaustubha Govind
on 13 Apr 2012
0 votes
I would recommend debugging your S-function to find the exact line that's causing the SegV and post back when you have more information.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!