crash when runing matlab 2010b 64bit mex

1 view (last 30 days)
li qi
li qi on 1 Aug 2013
I am using matlab 2010b running some simulatoin. It uses a mex funtion. I need to repeat 100 times, but it always crashs at like 20 or 30 times, but crash times are differenct every time. I dont know why. I though it was because 64 bit system, so i changed int to mwsize, but it didnt work.
Here is the code
#include "math.h"
#include "mex.h"
#include "matrix.h"
#include <time.h>
/*
* timestwo.c - example found in API guide
*
* Computational function that takes a scalar and double it.
*
* This is a MEX-file for MATLAB.
* Copyright 1984-2000 The MathWorks, Inc.
*/
/* $Revision: 1.8 $ */
void sig_var(double Y[],double mu_hat[],double X[],double T[],double dN[],double h,double t,mwIndex gamma_n,int tn,double m[],double Sigma[],int n,double IExx[],double Exz[],double InvA,double temp00[])
{
mwIndex col;
mwIndex i,j,k,l;
double u, *temp;
mxArray *temp0;
col=1;
temp0=mxCreateDoubleMatrix(gamma_n,col,mxREAL);
temp=mxGetPr(temp0);
for(i=0;i<n;i++)
{ for(k=0;k<gamma_n;k++)temp[k]=0;/////
for(j=0;j<m[i];j++)
{ u=fabs(T[i+n*j]-t)/h;
if(u<1)
for(k=0;k<gamma_n;k++)
for(l=0;l<gamma_n;l++)
temp[k]+=IExx[k+l*gamma_n]*X[i+n*(tn*l+j)]*(1-u*u)*0.75/h*(Y[i+n*j]-mu_hat[i+n*j])*dN[i+j*n] ;
}///////////////
for(k=0;k<gamma_n;k++)
for(l=0;l<gamma_n;l++)
Sigma[k+gamma_n*l]+=temp[k]*temp[l];
}//////////////////
mxDestroyArray( temp0);
}
/***************************************************************/
void mexFunction( mwIndex nlhs, mxArray *plhs[],
mwIndex nrhs, const mxArray *prhs[] )
{
double *Y,*mu_hat,*X,*T,*dN,h,t,*Sigma,*m,*IExx,*Exz,InvA,*temp00;
mwIndex gamma_n;
mwIndex tn,n;
/* Check for proper number of arguments. */
if(nrhs!=14) {
mexErrMsgTxt("Seven input required.");
} else if(nlhs>1) {
mexErrMsgTxt("Too many output arguments");
}
/* Check data type of input argument */
for(tn=0;tn<nrhs;tn++)
{
if (!(mxIsDouble(prhs[tn])))
{
mexErrMsgTxt("Input array must be of type double.");
}
}
//************************************
n = mxGetM(prhs[0]);
Y= mxGetPr(prhs[0]);
mu_hat= mxGetPr(prhs[1]);
X= mxGetPr(prhs[2]);
T= mxGetPr(prhs[3]);
dN= mxGetPr(prhs[4]);
h=mxGetScalar(prhs[5]);
t=mxGetScalar(prhs[6]);
gamma_n=(mwIndex)mxGetScalar(prhs[7]);
tn=(mwIndex)mxGetScalar(prhs[8]);
m= mxGetPr(prhs[9]);
IExx= mxGetPr(prhs[10]);
Exz= mxGetPr(prhs[11]);
InvA=mxGetScalar(prhs[12]);
temp00= mxGetPr(prhs[13]);
/* Create matrix for the return argument. */
plhs[0] = mxCreateDoubleMatrix( gamma_n, gamma_n, mxREAL);
/* Assign pointers to each input and output. */
//[N,T,Y,Xwave,m]=poison(X,R,C,tao,alpha0,alpha1,gamma);
Sigma= mxGetPr(plhs[0]);
/* Call the timestwo subroutine. */
sig_var(Y,mu_hat,X,T,dN,h,t,gamma_n,tn,m,Sigma,n,IExx,Exz,InvA,temp00);
/* Destroy array */
// mxDestroyArray( plhs[0]);
}**|||
  1 Comment
Jan
Jan on 1 Aug 2013
Edited: Jan on 1 Aug 2013
Please do not post relevant information as pseudo-answer.
I would not dare to post a license ID in the public Matlab forum which belongs to a cracked Matlab version. I've removed it, but I hesitate to post an answer in consequence.

Sign in to comment.

Answers (1)

li qi
li qi on 1 Aug 2013
Edited: Jan on 1 Aug 2013
The error information is MATLAB crash <file:C>:\Users\lqi\AppData\Local\Temp\matlab_crash_dump.8292:
------------------------------------------------------------------------ Segmentation violation detected at Wed Jul 31 19:57:37 2013 ------------------------------------------------------------------------
Configuration: MATLAB Version: 7.11.0.584 (R2010b) MATLAB License: **** Operating System: Microsoft Windows 7 Window System: Version 6.1 (Build 7601: Service Pack 1) Processor ID: x86 Family 6 Model 10 Stepping 7, GenuineIntel Virtual Machine: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot™ 64-Bit Server VM mixed mode Default Encoding: windows-1252
Fault Count: 1
Abnormal termination:
Register State (from fault): RAX = 0000000000000002 RBX = 0000000000000020 RCX = 0000000041f9b440 RDX = 0000000042a03c70 RSP = 00000000014297b0 RBP = 0000000000000006 RSI = 0000000044d8e120 RDI = 00000000000076c0
R8 = 0000000000000002 R9 = 00000000429e6170
R10 = 0000000000000030 R11 = 0000000000000000
R12 = 0000000000000004 R13 = 0000000000000006
R14 = 0000000042084fd0 R15 = 0000000000000000
RIP = 000007fefb8a13e3 EFL = 00010202
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault): [ 0] 0x000007fefb8a13e3 F:/uncc/_PhD research/treatment switching/code/new/Ualpha.mexw64+00005091 ( ???+000000 ) [ 1] 0x000007fefb8a16c8 F:/uncc/_PhD research/treatment switching/code/new/Ualpha.mexw64+00005832 ( mexFunction+000392 ) [ 2] 0x000000007cba4033 C:/matlab/bin/win64/libmex.dll+00016435 ( mexRunMexFile+000131 ) [ 3] 0x000000007cba1fcf C:/matlab/bin/win64/libmex.dll+00008143 ( inSwapMexfileReader+000223 ) [ 4] 0x000000007cba2194 C:/matlab/bin/win64/libmex.dll+00008596 ( inSwapMexfileReader+000676 ) [ 5] 0x000000007af50f0e C:/matlab/bin/win64/m_dispatcher.dll+00069390 ( Mfh_file::dispatch_fh+000334 ) [ 6] 0x000000007af5121f C:/matlab/bin/win64/m_dispatcher.dll+00070175 ( Mfunction_handle::dispatch+000511 ) [ 7] 0x000000007b9010e4 C:/matlab/bin/win64/m_interpreter.dll+00659684 ( inDestroyWS+005028 ) [ 8] 0x000000007b8ea481 C:/matlab/bin/win64/m_interpreter.dll+00566401 ( inPathNotification::refresh_notification+459441 ) [ 9] 0x000000007b8babb5 C:/matlab/bin/win64/m_interpreter.dll+00371637 ( inPathNotification::refresh_notification+264677 ) [ 10] 0x000000007b8cf869 C:/matlab/bin/win64/m_interpreter.dll+00456809 ( inPathNotification::refresh_notification+349849 ) [ 11] 0x000000007b8d7839 C:/matlab/bin/win64/m_interpreter.dll+00489529 ( inPathNotification::refresh_notification+382569 ) [ 12] 0x000000007b8d4fe5 C:/matlab/bin/win64/m_interpreter.dll+00479205 ( inPathNotification::refresh_notification+372245 ) [ 13] 0x000000007b8f07b3 C:/matlab/bin/win64/m_interpreter.dll+00591795 ( inPathNotification::refresh_notification+484835 ) [ 14] 0x000000007b8f092f C:/matlab/bin/win64/m_interpreter.dll+00592175 ( inPathNotification::refresh_notification+485215 ) [ 15] 0x000000007b8df5df C:/matlab/bin/win64/m_interpreter.dll+00521695 ( inPathNotification::refresh_notification+414735 ) [ 16] 0x000000007b8dda79 C:/matlab/bin/win64/m_interpreter.dll+00514681 ( inPathNotification::refresh_notification+407721 ) [ 17] 0x000000007b8e9d29 C:/matlab/bin/win64/m_interpreter.dll+00564521 ( inPathNotification::refresh_notification+457561 ) [ 18] 0x000000007af50f0e C:/matlab/bin/win64/m_dispatcher.dll+00069390 ( Mfh_file::dispatch_fh+000334 ) [ 19] 0x000000007af5121f C:/matlab/bin/win64/m_dispatcher.dll+00070175 ( Mfunction_handle::dispatch+000511 ) [ 20] 0x000000007b9010e4 C:/matlab/bin/win64/m_interpreter.dll+00659684 ( inDestroyWS+005028 ) [ 21] 0x000000007b8ea481 C:/matlab/bin/win64/m_interpreter.dll+00566401 ( inPathNotification::refresh_notification+459441 ) [ 22] 0x000000007b8babb5 C:/matlab/bin/win64/m_interpreter.dll+00371637 ( inPathNotification::refresh_notification+264677 ) [ 23] 0x000000007b8cf869 C:/matlab/bin/win64/m_interpreter.dll+00456809 ( inPathNotification::refresh_notification+349849 ) [ 24] 0x000000007b8d7839 C:/matlab/bin/win64/m_interpreter.dll+00489529 ( inPathNotification::refresh_notification+382569 ) [ 25] 0x000000007b8d4fe5 C:/matlab/bin/win64/m_interpreter.dll+00479205 ( inPathNotification::refresh_notification+372245 ) [ 26] 0x000000007b8f07b3 C:/matlab/bin/win64/m_interpreter.dll+00591795 ( inPathNotification::refresh_notification+484835 ) [ 27] 0x000000007b8f092f C:/matlab/bin/win64/m_interpreter.dll+00592175 ( inPathNotification::refresh_notification+485215 ) [ 28] 0x000000007b8df5df C:/matlab/bin/win64/m_interpreter.dll+00521695 ( inPathNotification::refresh_notification+414735 ) [ 29] 0x000000007b8dda79 C:/matlab/bin/win64/m_interpreter.dll+00514681 ( inPathNotification::refresh_notification+407721 ) [ 30] 0x000000007b8e9d29 C:/matlab/bin/win64/m_interpreter.dll+00564521 ( inPathNotification::refresh_notification+457561 ) [ 31] 0x000000007af50f0e C:/matlab/bin/win64/m_dispatcher.dll+00069390 ( Mfh_file::dispatch_fh+000334 ) [ 32] 0x000000007af5121f C:/matlab/bin/win64/m_dispatcher.dll+00070175 ( Mfunction_handle::dispatch+000511 ) [ 33] 0x000000007b979489 C:/matlab/bin/win64/m_interpreter.dll+01152137 ( inAnonymousFunction+001993 ) [ 34] 0x000000007b97a358 C:/matlab/bin/win64/m_interpreter.dll+01155928 ( inSetPredictor+001384 ) [ 35] 0x000000007b86cc14 C:/matlab/bin/win64/m_interpreter.dll+00052244 ( ???+000000 ) [ 36] 0x000000007b97abf0 C:/matlab/bin/win64/m_interpreter.dll+01158128 ( inSetPredictor+003584 ) [ 37] 0x000000007b97ac9c C:/matlab/bin/win64/m_interpreter.dll+01158300 ( inSetPredictor+003756 ) [ 38] 0x000000007b97acee C:/matlab/bin/win64/m_interpreter.dll+01158382 ( inEvalCmdWithLocalReturn+000062 ) [ 39] 0x00000000783693ba C:/matlab/bin/win64/libmwbridge.dll+00037818 ( mnInitializeParser+000186 ) [ 40] 0x000000007836ed52 C:/matlab/bin/win64/libmwbridge.dll+00060754 ( mnParser+000450 ) [ 41] 0x000000007b102e74 C:/matlab/bin/win64/mcr.dll+00274036 ( mcrInstance::mnParser_on_interpreter_thread+000036 ) [ 42] 0x000000007b0de6eb C:/matlab/bin/win64/mcr.dll+00124651 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+052907 ) [ 43] 0x000000007b0d9d22 C:/matlab/bin/win64/mcr.dll+00105762 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+034018 ) [ 44] 0x000000007c84dd0e C:/matlab/bin/win64/uiw.dll+00449806 ( UIW_IsUserMessage+000110 ) [ 45] 0x000000007c84e464 C:/matlab/bin/win64/uiw.dll+00451684 ( ws_ProcessPendingEventsWaitForWindows+000356 ) [ 46] 0x00000000766b87fe C:/Windows/system32/USER32.dll+00165886 ( GetMenuBarInfo+000638 ) [ 47] 0x000000007669f5fb C:/Windows/system32/USER32.dll+00062971 ( SystemParametersInfoW+000235 ) [ 48] 0x00000000766a4895 C:/Windows/system32/USER32.dll+00084117 ( IsProcessDPIAware+000465 ) [ 49] 0x0000000076dc1225 C:/Windows/SYSTEM32/ntdll.dll+00332325 ( KiUserCallbackDispatcher+000031 ) [ 50] 0x00000000766a9e6a C:/Windows/system32/USER32.dll+00106090 ( SfmDxSetSwapChainStats+000026 ) [ 51] 0x00000000766a615e C:/Windows/system32/USER32.dll+00090462 ( GetMessageA+000078 ) [ 52] 0x000000007c80cc17 C:/matlab/bin/win64/uiw.dll+00183319 ( UIW_SetCurrentDialog+000855 ) [ 53] 0x000000007c84fa97 C:/matlab/bin/win64/uiw.dll+00457367 ( ws_FreeSystemFont+000519 ) [ 54] 0x000000007ac680af C:/matlab/bin/win64/libuij.dll+00229551 ( sysq::ws_ppeHook::~ws_ppeHook+011903 ) [ 55] 0x000000007ac6a08a C:/matlab/bin/win64/libuij.dll+00237706 ( svWS_CommitDatabaseUpdates+003498 ) [ 56] 0x000000007ac6ae91 C:/matlab/bin/win64/libuij.dll+00241297 ( svWS_CommitDatabaseUpdates+007089 ) [ 57] 0x000000007ac6b3a9 C:/matlab/bin/win64/libuij.dll+00242601 ( svWS_CommitDatabaseUpdates+008393 ) [ 58] 0x000000007ac6b7e2 C:/matlab/bin/win64/libuij.dll+00243682 ( svWS_CommitDatabaseUpdates+009474 ) [ 59] 0x000000007ac6bab7 C:/matlab/bin/win64/libuij.dll+00244407 ( svWS_CommitDatabaseUpdates+010199 ) [ 60] 0x000000007b0dfb0c C:/matlab/bin/win64/mcr.dll+00129804 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+058060 ) [ 61] 0x000000007b0e00a9 C:/matlab/bin/win64/mcr.dll+00131241 ( mvm::detail::RecursiveScopedMcrLock::~RecursiveScopedMcrLock+059497 ) [ 62] 0x000000007b0e091e C:/matlab/bin/win64/mcr.dll+00133406 ( mcr_invoke_on_interpreter_thread+000462 ) [ 63] 0x000000007b0e1822 C:/matlab/bin/win64/mcr.dll+00137250 ( mcr_invoke_on_interpreter_thread+004306 ) [ 64] 0x00000001400084c4 C:/matlab/bin/win64/matlab.exe+00033988 ( ???+000000 ) [ 65] 0x0000000140008669 C:/matlab/bin/win64/matlab.exe+00034409 ( ???+000000 ) [ 66] 0x0000000140008bcc C:/matlab/bin/win64/matlab.exe+00035788 ( ???+000000 ) [ 67] 0x00000000767a652d C:/Windows/system32/kernel32.dll+00091437 ( BaseThreadInitThunk+000013 ) [ 68] 0x0000000076d9c521 C:/Windows/SYSTEM32/ntdll.dll+00181537 ( RtlUserThreadStart+000033 )
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. MATLAB may attempt to recover, but even if recovery appears successful, we recommend that you save your workspace and restart MATLAB as soon as possible.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!