title: Genetic algorithm (using parallel computing) stops when using google random forest as cost function in MATLAB
body: <p>I'm using random forest (google code) (<a href="https://code.google.com/archive/p/randomforest-matlab" rel="nofollow noreferrer">THIS LINK</a>) as cost function of MATLAB genetic algorithm using MATLAB parallel computing. When I active parallel computing in genetic algorithm, after some hours of processing, parallel computing stops. This is log from temp folder. There isn't any problem when I use genetic algorithm without parallel computing. My MATLAB version is R2016b.</p>
  
  <pre><code>Fault Count: 1
  
  
  Abnormal termination:
  Access violation
  
  Register State (from fault):
    RAX = 0000000000000000  RBX = 00000000043f9710
    RCX = 00000000585b33c0  RDX = 0000000000000001
    RSP = 00000000043f8640  RBP = 00000000043f9710
    RSI = 000000000000016a  RDI = 000000009dc60f10
  
     R8 = 0000000000000000   R9 = 000000009dc60f10
    R10 = 000000000000000f  R11 = 00000000043f9710
    R12 = 0000000000000000  R13 = 0000000089ee3090
    R14 = 000000000000127f  R15 = 000000000000000f
  
    RIP = 0000000022057b05  EFL = 00010206
  
     CS = 0033   FS = 0053   GS = 002b
  
  Stack Trace (from fault):
  [  0] 0x0000000022057b05 C:\Users\XXX\Desktop\XB\Code - Tree - new\mexClassRF_train.mexw64+00031493 mexFunction+00000197
  [  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] 0x0000000015b646de C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
  [  5] 0x0000000015b644b6 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017590 Mfh_file::dispatch_fh+00000062
  [  6] 0x0000000015b65827 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00022567 Mfunction_handle::dispatch+00001015
  [  7] 0x0000000016a28c29 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00887849 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00798773
  [  8] 0x0000000016a28707 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00886535 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00797459
  [  9] 0x0000000016a274b8 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00881848 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00792772
  [ 10] 0x00000000169a9eab C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00368299 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00279223
  [ 11] 0x00000000169a9740 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00366400 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00277324
  [ 12] 0x0000000016a31d1c C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00924956 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00835880
  [ 13] 0x0000000016a31939 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923961 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00834885
  [ 14] 0x0000000016a31884 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923780 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00834704
  [ 15] 0x0000000015b646de C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
  [ 16] 0x0000000015b644fa C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017658 Mfh_file::dispatch_fh_with_reuse+00000062
  [ 17] 0x0000000016a25166 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00872806 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00783730
  [ 18] 0x00000000169a40b7 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00344247 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00255171
  [ 19] 0x00000000169a430a C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00344842 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00255766
  [ 20] 0x00000000169f38ea C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00669930 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00580854
  [ 21] 0x0000000016b61a56 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+02169430 boost::archive::detail::oserializer&lt;boost::archive::binaryTerm_oarchive,boost::shared_ptr&lt;MathWorks::lxe::MatlabIrTree&gt; &gt;::oserializer&lt;boost::archive::binaryTerm_oarchive,boost::shared_ptr&lt;MathWorks::lxe::MatlabIrTree&gt; &gt;+00001726
  [ 22] 0x0000000016b619e9 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+02169321 boost::archive::detail::oserializer&lt;boost::archive::binaryTerm_oarchive,boost::shared_ptr&lt;MathWorks::lxe::MatlabIrTree&gt; &gt;::oserializer&lt;boost::archive::binaryTerm_oarchive,boost::shared_ptr&lt;MathWorks::lxe::MatlabIrTree&gt; &gt;+00001617
  [ 23] 0x00000000169f2ca2 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00666786 boost::serialization::singleton&lt;boost::archive::detail::iserializer&lt;boost::archive::binaryTerm_iarchive,ir::IrTree&gt; &gt;::get_instance+00577710
  [ 24] 0x0000000015d80123 C:\Program Files\MATLAB\R2016b\bin\win64\m_interpreter.dll+00196899 inCallFcnWithTrapInDesiredWSAndPublishEvents+00000071
  [ 25] 0x00000000fcfdcf52   C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00315218 iqm::BaseFEvalPlugin::inCallFcnWithTrap+00000066
  [ 26] 0x00000000fcfdcb7f   C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00314239 iqm::BaseFEvalPlugin::execute+00000335
  [ 27] 0x0000000015a6ae39   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00306745 mcrRegisterExternalFunction+00035625
  [ 28] 0x000000001d2f501e   C:\Program Files\MATLAB\R2016b\bin\win64\jmi.dll+00675870 LoadJAWTLibrary+00009438
  [ 29] 0x00000000fcfd42fa   C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00279290 iqm::Iqm::setupIqmFcnPtrs+00071530
  [ 30] 0x00000000fcfd41d3   C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00278995 iqm::Iqm::setupIqmFcnPtrs+00071235
  [ 31] 0x00000000fcfb95a5   C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00169381 iqm::Iqm::deliver+00001045
  [ 32] 0x00000000fb5fb545 C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00046405 ioReadLine+00000293
  [ 33] 0x00000000fb5fb342 C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00045890 ioCmdLineEditSave+00019986
  [ 34] 0x00000000fb5fb40b C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00046091 ioReadLine+00000107
  [ 35] 0x00000000fb609691 C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00104081 mnDebugPrompt+00001521
  [ 36] 0x00000000fb6091ba C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00102842 mnDebugPrompt+00000282
  [ 37] 0x00000000fb6098fa C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00104698 mnParser+00000410
  [ 38] 0x0000000015a56841   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00223297 mcr::runtime::setInterpreterThreadToCurrent+00025585
  [ 39] 0x0000000015a557d7   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219095 mcr::runtime::setInterpreterThreadToCurrent+00021383
  [ 40] 0x0000000015a55853   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219219 mcr::runtime::setInterpreterThreadToCurrent+00021507
  [ 41] 0x0000000015a56141   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] 0x0000000100108173 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01147251 services::system_events::PpeDispatchHook::dispatchOne+00019059
  [ 55] 0x000000010010c3a3 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164195 sysq::addProcessPendingEventsUnitTestHook+00001923
  [ 56] 0x000000010010c580 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164672 sysq::addProcessPendingEventsUnitTestHook+00002400
  [ 57] 0x000000010010d685 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01169029 sysq::getCondition+00002917
  [ 58] 0x000000010010e4b2 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01172658 svWS_ProcessPendingEvents+00000162
  [ 59] 0x0000000015a56b7d   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00224125 mcr::runtime::setInterpreterThreadToCurrent+00026413
  [ 60] 0x0000000015a5726a   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00225898 mcr::runtime::setInterpreterThreadToCurrent+00028186
  [ 61] 0x0000000015a4e385   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00189317 mcr_process_events+00010293
  [ 62] 0x0000000015a502d2   C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00197330 mcr_process_events+00018306
  [ 63] 0x00000000158fbd0e 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] 0x00007ffbed5c8364                   C:\WINDOWS\System32\KERNEL32.DLL+00033636 BaseThreadInitThunk+00000020
  [ 70] 0x00007ffbf00970d1                      C:\WINDOWS\SYSTEM32\ntdll.dll+00422097 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.
  
  Thank you for your help.
  </code></pre>