필터 지우기
필터 지우기

Mex: out of memory mxCreateNumericArray

조회 수: 3 (최근 30일)
mick strife
mick strife 2013년 4월 22일
Hello,
i m getting an error "out of memory" when i m declaring an large array. but when i m declaring an small array it works. Unfortunately i m beginner in mex. Can someone tell pls how i can solve this problem? Many many thanks!
// works
int dim[3] = {400,3,1000};
plhs[0] = mxCreateNumericArray(3, dim, mxDOUBLE_CLASS, mxREAL);
// doesnt work
int dim[3] = {4000,3,10000};
plhs[0] = mxCreateNumericArray(3, dim, mxDOUBLE_CLASS, mxREAL);

채택된 답변

Friedrich
Friedrich 2013년 4월 22일
Hi,
that works fine for me. I assume you use a 32bit MATLAB? The variable you create needs 960mb of memory in one piece which is most likely not available for you.
You can use the memory command (Windows only!) to see what the biggest matrix is you can allocate.
Small advice: Don't use an int for the dimensions. Use mwSize. This is a bittedness independent type.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by