OUT OF MEMORY problem
10 views (last 30 days)
Show older comments
Dear Matlab community,
I am trying to run a very big linear continuos optimization problem (inequality constraints matrix is 674520 x 586979 and equality matrix is 43802 x 674520, both of them very sparse) and I am keep receiving the message:
Out of memory. Type HELP MEMORY for your options.
Error in lipsol>getpu (line 1475)
P = A * spdiags(vmid,0,n,n) * A';
Error in lipsol (line 694)
[P,U] = getpu(A,ones(n,1),Dense_cols_exist,idense,ispars);
Error in linprog (line 278)
[x,fval,lambda,exitflag,output] =
lipsol(f,A,B,Aeq,Beq,lb,ub,options,defaultopt,computeLambda);
Error in calling_linear_optimization (line 6)
[x,fval,exitflag,output,lambda] = linprog(OBJ_goal,A,b,A_equality,beq,lb,up);
When I type in MEMORY I got this:
memory Maximum possible array: 6734 MB (7.061e+09 bytes) *
Memory available for all arrays: 6734 MB (7.061e+09 bytes) *
Memory used by MATLAB: 2301 MB (2.413e+09 bytes)
Physical Memory (RAM): 8083 MB (8.475e+09 bytes)
Limited by System Memory (physical + swap file) available.
As it seems I have enough memory (my computer has 7.89 GB of usable RAM, 64-bit version of both windows and Matlab), could you help me with the message if something else is actually wrong? I'm using sparse matrices for both inequality and equality constrinats (A and Aeq) and both of them are less than 50 mb in size.
I would appreciate any comment!
Best regards,
Dominik
2 Comments
Jan
on 14 Dec 2015
Edited: Jan
on 14 Dec 2015
Did you posts the examples of Matlab's help section? Or are these the values of your machine? If you have a 64 bit Matlab, thet output for "memory command on a 32-bit Windows system" looks suspicious. Did you type the memory command in the command window?
Answers (1)
Jan
on 14 Dec 2015
The strategies to solve this problem are always the same, as you can examine by a search in this forum:
- Install more RAM
- Run 64 bit versions (as you do already)
- Install more RAM
- Free memory by stopping other programs
- Install more RAM
- Use smaller data types, if possible: A single array uses the half of memory
- Create structs/cells of arrays instead og arrays of structs/cells
- Install more RAM
- Check if you accidently create huge arrays e.g. by rand(1e6) if rand(1, 1e6) was meant
- Check if any matrix became full by accident, when a sparse way of storage is required.
- Install even more RAM
5 Comments
Walter Roberson
on 14 Dec 2015
MATLAB was using that much at the time you asked. Each function has its own workspace that allocates memory and the memory gets returned to the pool when the function returns. By the time that you got to
P = A * spdiags(vmid,0,n,n) * A';
you did not have enough memory to do the calculation, but when the routine returned because of the error, all of the temporary memory was given back.
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!