Matlab doesn't seem to be using all the memory available to it and gives out of memory error.
2 views (last 30 days)
Show older comments
Jonathan Fernow
on 21 Jun 2019
Edited: Jonathan Fernow
on 26 Jun 2019
I am running my code, and it seems to be needing more and more memory, I check the windows memory and it stays the same giving matlab 1 Gb instead of the 6 or 24 that is availible to it. I have been trying sparce I have "clearvars -global" and "clear all" at the beginning of my code I have reassignment to "=[]" and sparse, but Matlab doesn't use or direct me to where or why it can't use the the 32 it has detected of system memory but gives up when it knows it is using 2 Gb according to the memory command.
Error Message:
Out of memory. Type "help memory" for your options.
Error in dembedding_v8 (line 165)
fd_square_inv_alligned = s_param_inv_alligned .* y;
>> whos
Name Size Bytes Class Attributes
x1 1x1 8 double
x2 1x1 8 double
x3 1x1 8 double
x4 1x1 8 double
x5 1x88 176 char
x6 1x90 180 char
x7 1x87 174 char
x8 1x50000 400000 double
x9 1x1 8 double
x10 1x1 8 double
x11 1x1 8 double
x12 1x1 8 double
x13 1x1 8 double
x14 100084x1 800672 double
x15 50000x1 800000 double complex
x16 50000x1 800000 double complex
x17 1x100000 800000 double
x18 1x1 8 double
x19 1x1 8 double
x20 1x100000 800000 double
y21 1x100000 1600000 double complex
note: summing the bytes in whos I get 6001290B or 6MB? which doesn't seem right
>> memory
Maximum possible array: 24202 MB (2.538e+10 bytes) *
Memory available for all arrays: 24202 MB (2.538e+10 bytes) *
Memory used by MATLAB: 2156 MB (2.261e+09 bytes)
Physical Memory (RAM): 32768 MB (3.436e+10 bytes)
* Limited by System Memory (physical + swap file) available.
Edit: Thank you all for your help and insite with the .* failure(doing a matrix square instead of a 1 by x vector resutl I was getting a x by x size matrix) I am able to do 100,000,000 elements for accuracy and add a 1 million for loop all excecuting. Thank you all for your help and comments.
12 Comments
Walter Roberson
on 24 Jun 2019
Your x1 is a column vector. Your y1 is row vector. Since R2016b your code has been the same as if you had written bsxfun(@times, x1, y1) which is like
repmat(x1, 1, length(y1)) .* repmat(y1, length(x1), 1)
producing a rectangular result.
You need x1.'.* y1
Accepted Answer
Fikret Dogru
on 22 Jun 2019
Hello,
You can change your variables to single(variables) so it reduces the memory half and in the preferences increase java space to the maximum.
4 Comments
Walter Roberson
on 26 Jun 2019
This would probably be irrelevant if you were not using .* between a row vector and a column vector.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!