I am getting following errors in mex file

4 views (last 30 days)
Asghar Ali
Asghar Ali on 26 Mar 2017
Edited: Jan on 27 Mar 2017
------------------------------------------------------------------------
Access violation detected at Sun Mar 26 12:21:15 2017
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Current Graphics Driver: Unknown hardware
Default Encoding : windows-1252
Deployed : false
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA Quadro K620 Version 9.18.13.4052
Host Name : C1058
MATLAB Architecture : win64
MATLAB Entitlement ID: 859636
MATLAB Root : C:\Program Files\MATLAB\R2016b
MATLAB Version : 9.1.0.441655 (R2016b)
OpenGL : hardware
Operating System : Microsoft Windows 7 Enterprise
Processor ID : x86 Family 6 Model 60 Stepping 3, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 6.1 (Build 7601: Service Pack 1)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000000000000 RBX = 00000000000006a0
RCX = 0000000000000004 RDX = 0000000000000001
RSP = 000000000402a460 RBP = 00000000000001d3
RSI = 0000000000000004 RDI = 00000000000001d3
R8 = 0000000000000001 R9 = 000000000000025a
R10 = 0000000000000258 R11 = 00000001b7d753c0
R12 = 0000000000000258 R13 = 0000000000000000
R14 = 00000001b7d753c0 R15 = 00000000ff7592e0
RIP = 00000000322013de EFL = 00010202
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00000000322013de C:\Text_Detection_Recognition\Word-Spotting\Word-Spotting\util\bin\computeStats_c.mexw64+00005086 mexFunction+00000958
[ 1] 0x00000000fc5fc5d1 C:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00116177 mexRunMexFile+00000129
[ 2] 0x00000000fc5fb2e2 C:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00111330 mexFeature_mexver+00001794
[ 3] 0x00000000fc5fa506 C:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00107782 mexUnlock+00020182
[ 4] 0x000000000c6a46de C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
[ 5] 0x000000000c6a44b6 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017590 Mfh_file::dispatch_fh+00000062
[ 6] 0x000000000c6a5827 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00022567 Mfunction_handle::dispatch+00001015
[ 7] 0x000000000d6c8c29 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00887849 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00798773
[ 8] 0x000000000d6c8707 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00886535 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00797459
[ 9] 0x000000000d6c74b8 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00881848 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00792772
[ 10] 0x000000000d649eab C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00368299 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00279223
[ 11] 0x000000000d649740 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00366400 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00277324
[ 12] 0x000000000d6d1efe C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00925438 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00836362
[ 13] 0x000000000d6d195a C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923994 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834918
[ 14] 0x000000000d6d1979 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00924025 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834949
[ 15] 0x000000000c6a46de C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
[ 16] 0x000000000c6a44b6 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017590 Mfh_file::dispatch_fh+00000062
[ 17] 0x000000000c6a5827 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00022567 Mfunction_handle::dispatch+00001015
[ 18] 0x000000000d6cbfbd C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00901053 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00811977
[ 19] 0x000000000d69fbc0 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00719808 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00630732
[ 20] 0x000000000d6d728f C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00946831 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00857755
[ 21] 0x000000000d6d7b75 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00949109 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00860033
[ 22] 0x000000000d6d9151 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00954705 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00865629
[ 23] 0x000000000d6d9c95 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00957589 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00868513
[ 24] 0x000000000d6d932f C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00955183 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00866107
[ 25] 0x000000000d6d940d C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00955405 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00866329
[ 26] 0x000000000d6c8041 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00884801 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00795725
[ 27] 0x000000000d649eab C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00368299 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00279223
[ 28] 0x000000000d649740 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00366400 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00277324
[ 29] 0x000000000d643f8f C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00343951 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00254875
[ 30] 0x000000000d643aa1 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00342689 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00253613
[ 31] 0x000000000d643991 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00342417 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00253341
[ 32] 0x000000000d7d03e9 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+01967081 boost::serialization::singleton<boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive,foundation::msg_svc::eventmgr::BaseEvent> >::get_instance+00003353
[ 33] 0x000000000d7d0372 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+01966962 boost::serialization::singleton<boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive,foundation::msg_svc::eventmgr::BaseEvent> >::get_instance+00003234
[ 34] 0x000000000d692a61 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00666209 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00577133
[ 35] 0x000000000c90b3bd C:\Program Files\MATLAB\R2016b\bin\win64\m_interpreter.dll+00504765 inEvalCmdWithLocalReturn+00000065
[ 36] 0x00000000fb608ced C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00101613 mnGetPrompt+00012957
[ 37] 0x00000000fb609ba3 C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00105379 mnParser+00001091
[ 38] 0x000000000d406841 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00223297 mcr::runtime::setInterpreterThreadToCurrent+00025585
[ 39] 0x000000000d4057d7 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219095 mcr::runtime::setInterpreterThreadToCurrent+00021383
[ 40] 0x000000000d405853 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219219 mcr::runtime::setInterpreterThreadToCurrent+00021507
[ 41] 0x000000000d406141 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00221505 mcr::runtime::setInterpreterThreadToCurrent+00023793
[ 42] 0x00000000fd01d347 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00578375 iqm::UserEvalPlugin::pre+00030679
[ 43] 0x00000000fd029e7c C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00630396 iqm::UserEvalPlugin::pre+00082700
[ 44] 0x00000000fd017480 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00554112 iqm::UserEvalPlugin::pre+00006416
[ 45] 0x00000000fd02c99a C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00641434 iqm::UserEvalPlugin::pre+00093738
[ 46] 0x00000000fcff9a37 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00432695 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000727
[ 47] 0x00000000fcffa08f C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00434319 iqm::PackagedTaskPlugin::execute+00000575
[ 48] 0x00000000fcff9aa9 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00432809 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000841
[ 49] 0x00000000fcff9f04 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00433924 iqm::PackagedTaskPlugin::execute+00000180
[ 50] 0x00000000fcfd42fa C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00279290 iqm::Iqm::setupIqmFcnPtrs+00071530
[ 51] 0x00000000fcfd41d3 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00278995 iqm::Iqm::setupIqmFcnPtrs+00071235
[ 52] 0x00000000fcfb9e5a C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00171610 iqm::Iqm::deliver+00003274
[ 53] 0x00000000fcfbad2f C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00175407 iqm::Iqm::deliver+00007071
[ 54] 0x0000000004538173 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01147251 services::system_events::PpeDispatchHook::dispatchOne+00019059
[ 55] 0x000000000453c3a3 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164195 sysq::addProcessPendingEventsUnitTestHook+00001923
[ 56] 0x000000000453c580 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164672 sysq::addProcessPendingEventsUnitTestHook+00002400
[ 57] 0x000000000453d685 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01169029 sysq::getCondition+00002917
[ 58] 0x000000000453e4b2 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01172658 svWS_ProcessPendingEvents+00000162
[ 59] 0x000000000d406b7d C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00224125 mcr::runtime::setInterpreterThreadToCurrent+00026413
[ 60] 0x000000000d40726a C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00225898 mcr::runtime::setInterpreterThreadToCurrent+00028186
[ 61] 0x000000000d3fe385 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00189317 mcr_process_events+00010293
[ 62] 0x000000000d4002d2 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00197330 mcr_process_events+00018306
[ 63] 0x000000000c61bd0e C:\Program Files\MATLAB\R2016b\bin\win64\MVMLocal.dll+00245006 mvm_server::inproc::LocalFactory::terminate+00070846
[ 64] 0x00000000fa942cd9 C:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01125593 mvm::detail::initLocalMvmHack+00000521
[ 65] 0x00000000fa9432a5 C:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01127077 mvm::detail::SessionImpl::privateSession+00000373
[ 66] 0x00000000fa9434b1 C:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01127601 mvm::detail::SessionImpl::privateSession+00000897
[ 67] 0x0000000140006fd5 C:\Program Files\MATLAB\R2016b\bin\win64\MATLAB.exe+00028629
[ 68] 0x0000000140007661 C:\Program Files\MATLAB\R2016b\bin\win64\MATLAB.exe+00030305
[ 69] 0x00000000771259cd C:\Windows\system32\kernel32.dll+00088525 BaseThreadInitThunk+00000013
[ 70] 0x000000007735a561 C:\Windows\SYSTEM32\ntdll.dll+00173409 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.
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
  6 Comments
Asghar Ali
Asghar Ali on 26 Mar 2017
Edited: James Tursa on 26 Mar 2017
the value of
S = 200X600,
queriesClases = 1x200,
allClasses = 1x600,
NRelevantsPerQuery = 200x1,
keepQueries = 200x1
Asghar Ali
Asghar Ali on 26 Mar 2017
Dear Geoff Hayes, above is the call of mex file and values of variables. I have tried a lot but could not find any solution.

Sign in to comment.

Answers (1)

Jan
Jan on 26 Mar 2017
Edited: Jan on 27 Mar 2017
Command like this are very tricky:
queriesCls = (int*)mxGetData(prhs[1]);
Are you sure that the compiler uses the wanted number of bits? Prefer int32_T according to the type of the Matlab variable provided as input. E.g.:
plhs[2] = mxCreateNumericArray(1, dims, mxINT32_CLASS, mxREAL);
bestIdx = (int32_T *) mxGetData(plhs[2]);
[EDITED] This line looks cruel:
int *rank;
*rank = (int) malloc(NRelevantsPerQuery[i] * sizeof(int));
This would look better:
rank = (int *) malloc(NRelevantsPerQuery[i] * sizeof(int));
But even with this, rank is allocated in each iteration, but never free'd. This will leak memory.
  2 Comments
Asghar Ali
Asghar Ali on 27 Mar 2017
Thank you so much Jan Simon, it is still showing the same error.
Jan
Jan on 27 Mar 2017
What exactly does "still" mean? What did you change? All occurences of the tricky int?
See [EDITED]

Sign in to comment.

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) 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!