필터 지우기
필터 지우기

(weird) Out Of Memory Error

조회 수: 2 (최근 30일)
Luca Cerone
Luca Cerone 2012년 8월 30일
Dear all, I'm experiencing a weird out of memory error that can't really understand.
I have a few big 3D matrices A,B,X and a 3D vector N. I use A,B and N to fill X (one row at a time) doing something like: (X is preallocated to all zeroes)
X(i,:,k)= (A(i,:,k).*B(i,:,k))/N(i,1,k);
This causes some OUT OF MEMORY error, which might be fine.
What bothers me is that, when debugging, if I try to assign the right end to a NEW variable "p" then there is no problem.
That is if I write:
p = (A(i,:,k).*B(i,:,k))/N(i,1,k);
p is created and the values are assigned correctly.
However if I try to assign p to the row of X then the same issue appears:
X(i,:,k)=p; % this causes an OUT OF MEMORY ERROR
Now, this doesn't make sense to me. In theory the memory for X has already been allocated. Why the creation of a new (additional) vector doesn't cause an OUT OF MEMORY ERROR, while the assignment of a vector into an already existing Matrix causes does?
What can I do to overcome this? Before trying the assignment, only 20% of my memory is used by MATLAB (according to TOP), so I guess that should be more than enough.
I'have already increased the available memory for Matlab and followed (I think correctly) the advices provided in the MATLAB help. I'd like to find a fast "quick and dirty" solution to overcome this issue, that else would require rewriting a significant portion of code.
Thanks a lot for your help, Cheers, Luca

답변 (1개)

Jason Ross
Jason Ross 2012년 8월 30일
For quick and dirty, I'd set the memoryuse / vmemoryuse to "unlimited" and see what happens.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by