Memory leak with Mex
이전 댓글 표시
I am doing below in a loop with dims = [1024 768 256]
1. I want to read a set of block loaded by block_iter(1 to 16) into a RAM of Hardware. The memory call seems to display the memory leaking. Am I doing it wrong somewhere?
// Create memory for reading in data
mxArray *B= mxCreateNumericArray(3,dims,mxUINT8_CLASS,mxREAL);
mxArray *in = mxCreateDoubleMatrix(1, 1, mxREAL);
// See Memory usage
mexCallMATLAB(0,NULL,0,NULL,"memory");
memcpy(mxGetPr(in), &block_iter, sizeof(double)*1*1);
// Read a block of 256 images of 1024*768. Even the temp variable is cleared in the dmd_feeder function
mexCallMATLAB(1,&B,1,&in,"data_feeder");
//Call RAM_FILL
ram_fill(d,B); // As of now does nothing, its an empty void function and I would be replacing it to copy data to ram of hardware.
//Deallocate memory;
mxDestroyArray(B);
mxDestroyArray(in);
PS: The memory leak is around 192 MB each loop which is exactly the amount of data in array B
댓글 수: 1
Jan
2013년 3월 11일
What is "a loop with dims"? What is "block_iter(1 to 16)"? What does "memory exactly reply"? Do you mean the size of the largest available block or the sum of the free memory? What happens inside "data_feeder"? What is "d" in the call of ram_fill() and are you really sure, that this function does not matter? If so, why do you include it in the example?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Troubleshooting in MATLAB Compiler SDK에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!