This error was detected while a MEX-file was running

12 views (last 30 days)
I'm working on an optimization problem for parallel manipulator. The optimization algorithm I use is the differential evolution exchange file developped by Markus Buehren and the intersection constrain of limbs regarded as cylinders is judged by exchange file developped by Bruno Luong .I simply write an object function which calls cylinder algorithm for jugdement as well as provides a function handle for DE algorithm. The project went well for the last 2 months but encountered a mex-file error today which indicates a problem in conv1 function written in C (The innner function developped in exchange file). Both exchange files can run successfully as an independent demo. I never encountered such a problem and I'll be very grateful if someone could help me. I want to know if it is a version upgrading problem or bug in C file or I just too careless when I modify the project. Thank you.
--------------------------------------------------------------------------------
Access violation detected at 周五 6月 10 12:31:31 2022 +0800
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : GBK
Deployed : false
Graphics Driver : Unknown hardware
Graphics card 1 : Actions Microelectronics Co., Ltd. ( 0x0 ) extension Graphics Adapter Version 1.1.215.84 (2020-10-16)
Graphics card 2 : NVIDIA ( 0x10de ) NVIDIA Quadro P600 Version 26.21.14.3172 (2019-7-25)
Graphics card 3 : Intel Corporation ( 0x8086 ) Intel(R) UHD Graphics 630 Version 26.20.100.7926 (2020-2-25)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 5150696
MATLAB Root : D:\Matlab R2020a\R2020a
MATLAB Version : 9.8.0.1380330 (R2020a) Update 2
OpenGL : hardware
Operating System : Microsoft Windows 10 家庭中文版
Process ID : 5612
Processor ID : x86 Family 6 Model 158 Stepping 10, GenuineIntel
Session Key : 49d185a7-86da-4f43-92e5-331378e6cc02
Window System : Version 10.0 (Build 19044)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000000000
RCX = 0000000000000008 RDX = fffffffffffffff8
RSP = 0000000c1f2fb970 RBP = 0000000c1f2fb9b0
RSI = 0000000000000002 RDI = 000001f755d4e8e0
R8 = 0000000000000001 R9 = 0000000000000002
R10 = 000001f755d4e8e0 R11 = 0000000000000000
R12 = 0000000000000002 R13 = 0000000000000003
R14 = 0000000000000003 R15 = 0000000000000000
RIP = 00007ffecb841494 EFL = 00010293
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00007ffecb841494 C:\Users\89382\Desktop\parallel optomozation\Dist3DCylinders\conv1.mexw64+00005268
[ 1] 0x00007ffecb84187a C:\Users\89382\Desktop\parallel optomozation\Dist3DCylinders\conv1.mexw64+00006266 mexFunction+00000138
[ 2] 0x00007ffe5d79d406 D:\Matlab R2020a\R2020a\bin\win64\libmex.dll+00381958 mexfile::Inspector::needs_upgrade+00015190
[ 3] 0x00007ffe5d79e7db D:\Matlab R2020a\R2020a\bin\win64\libmex.dll+00387035 MexRetrieveVersion+00003563
[ 4] 0x00007ffe5d79eb14 D:\Matlab R2020a\R2020a\bin\win64\libmex.dll+00387860 MexRetrieveVersion+00004388
[ 5] 0x00007ffe5d77f819 D:\Matlab R2020a\R2020a\bin\win64\libmex.dll+00260121 QueryMLFcnTable_libmex+00006377
[ 6] 0x00007ffe5dc4aebd bin\win64\pgo\m_dispatcher.dll+00634557 Mfh_file::dispatch_file_common+00000165
[ 7] 0x00007ffe5dc4a54d bin\win64\pgo\m_dispatcher.dll+00632141 Mfh_error::lookup+00006517
[ 8] 0x00007ffe5dc4ae11 bin\win64\pgo\m_dispatcher.dll+00634385 Mfh_file::dispatch+00000045
[ 9] 0x00007ffe5ab04002 bin\win64\pgo\m_lxe.dll+00540674
[ 10] 0x00007ffe5ab01ce4 bin\win64\pgo\m_lxe.dll+00531684
[ 11] 0x00007ffe5abe0179 bin\win64\pgo\m_lxe.dll+01442169 MathWorks::lxe::StartupLxeEngine+00239509
[ 12] 0x00007ffe5ab0033b bin\win64\pgo\m_lxe.dll+00525115
[ 13] 0x00007ffe5aafe6ff bin\win64\pgo\m_lxe.dll+00517887
[ 14] 0x00007ffe5aaf562e bin\win64\pgo\m_lxe.dll+00480814
[ 15] 0x00007ffe5aaf46ac bin\win64\pgo\m_lxe.dll+00476844
[ 16] 0x00007ffe5ab65abf bin\win64\pgo\m_lxe.dll+00940735
[ 17] 0x00007ffe5ab65c2b bin\win64\pgo\m_lxe.dll+00941099
[ 18] 0x00007ffe5ab65b22 bin\win64\pgo\m_lxe.dll+00940834
[ 19] 0x00007ffe5ab9ce70 bin\win64\pgo\m_lxe.dll+01166960
[ 20] 0x00007ffe5ab9ce1e bin\win64\pgo\m_lxe.dll+01166878
[ 21] 0x00007ffe5c5b4ef8 bin\win64\pgo\m_lxe.dll+28528376 MathWorks::lxe::profiler::IMexProfilingSupport::~IMexProfilingSupport+00083312
[ 22] 0x00007ffe5d6eda8c D:\Matlab R2020a\R2020a\bin\win64\libmwbridge.dll+00187020 mnParser+00001212
[ 23] 0x00007ffe5de56a99 D:\Matlab R2020a\R2020a\bin\win64\mcr.dll+00551577 mcr_set_enableReadingFromStdin+00016745
[ 24] 0x00007ffe5ddea05a D:\Matlab R2020a\R2020a\bin\win64\mcr.dll+00106586 mcrOptions::set_use_license_manager+00071962
[ 25] 0x00007ffe5de0b04a D:\Matlab R2020a\R2020a\bin\win64\mcr.dll+00241738 mcrOptions::set_use_license_manager+00207114
[ 26] 0x00007ffe5e08653e D:\Matlab R2020a\R2020a\bin\win64\iqm.dll+00615742 iqm::PackagedTaskPlugin::execute+00000862
[ 27] 0x00007ffe5e0863c9 D:\Matlab R2020a\R2020a\bin\win64\iqm.dll+00615369 iqm::PackagedTaskPlugin::execute+00000489
[ 28] 0x00007ffe5de5084e D:\Matlab R2020a\R2020a\bin\win64\mcr.dll+00526414 mcrIsExternalAvailableBuiltin+00045518
[ 29] 0x00007ffe5e05ca03 D:\Matlab R2020a\R2020a\bin\win64\iqm.dll+00444931 iqm::Iqm::setupIqmFcnPtrs+00100227
[ 30] 0x00007ffe5e034e2f D:\Matlab R2020a\R2020a\bin\win64\iqm.dll+00282159 iqm::Iqm::create+00009279
[ 31] 0x00007ffe5e034428 D:\Matlab R2020a\R2020a\bin\win64\iqm.dll+00279592 iqm::Iqm::create+00006712
[ 32] 0x00007ffe5de27d06 D:\Matlab R2020a\R2020a\bin\win64\mcr.dll+00359686 mcrInstantiationError::operator=+00012150
[ 33] 0x00007ffe5de2830c D:\Matlab R2020a\R2020a\bin\win64\mcr.dll+00361228 mcrInstantiationError::operator=+00013692
[ 34] 0x00007ffe5de25f0c D:\Matlab R2020a\R2020a\bin\win64\mcr.dll+00352012 mcrInstantiationError::operator=+00004476
[ 35] 0x00007ffecb92a203 D:\Matlab R2020a\R2020a\bin\win64\mwboost_thread-vc141-mt-x64-1_70.dll+00041475 mwboost::thread::swap+00000083
[ 36] 0x00007ffee22c1bb2 C:\WINDOWS\System32\ucrtbase.dll+00138162 configthreadlocale+00000146
[ 37] 0x00007ffee4977034 C:\WINDOWS\System32\KERNEL32.DLL+00094260 BaseThreadInitThunk+00000020
[ 38] 0x00007ffee4be2651 C:\WINDOWS\SYSTEM32\ntdll.dll+00337489 RtlUserThreadStart+00000033
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
** This crash report has been saved to disk as C:\Users\89382\AppData\Local\Temp\matlab_crash_dump.5612-1 **
Caught MathWorks::System::FatalException
[Please exit and restart MATLAB]>>

Answers (1)

Dinesh
Dinesh on 25 Oct 2023
Hi Yincheng,
I understand that you are encountering an 'Access violation detected' error when running your Mex files. This error typically occurs when there is an attempt to write to unallocated memory or memory is destroyed that is later used by MATLAB..
This issue is likely caused by a bug in your C code, specifically in the memory allocation and deallocation process. To resolve this, I recommend debugging your code in 'check memory allocation' mode to identify any calls made to deallocated memory or references to unallocated memory.
Regarding how to run MATLAB in 'check memory allocation' mode, please refer to the following MATLAB Answer thread:
Hope this helps.

Categories

Find more on Introduction to Installation and Licensing 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!