Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Out of Memory while using the lu command

Subject: Out of Memory while using the lu command

From: Vittal

Date: 8 Dec, 2012 17:03:08

Message: 1 of 2

Matlab throws and 'Out of Memory' error when I use the following command.
[L,U,P,Q,R] = lu(A);

The matrix 'A', is a sparse matrix of size 154401x154401, of type double.
I have checked that the matrix 'A' occupies 149024836bytes, using the 'whos' command just before calling the 'lu' function. 'A', as I can see, occupies just 143MB.

I have a 4GB RAM on my computer. I checked the memory usage when I start to execute the lu command. The memory increases all the way to 2.5GB (from about 990MB), before MATLAB throws an 'Out of Memory' error.

I am trying to figure out the following things.

1. Why is MATLAB throwing an 'Out of Memory' error when there is still about 1.5GB of RAM left for it to use?

2. Why is lu causing an increase in memory usage of about 1.5GB (RAM usage goes up from 990MB to 2.5GB)? It just doesn't make sense that it is using about 1.5GB to execute lu, and in fact, wants more!

Subject: Out of Memory while using the lu command

From: Bruno Luong

Date: 9 Dec, 2012 09:46:09

Message: 2 of 2

"Vittal" wrote in message <k9vrsc$bfl$1@newscl01ah.mathworks.com>...

>
> 1. Why is MATLAB throwing an 'Out of Memory' error when there is still about 1.5GB of RAM left for it to use?

Because memory request might not be possible even if there is something left (such as too fragmented, cannot be accessed by 32-bit addressing, etc).

>
> 2. Why is lu causing an increase in memory usage of about 1.5GB (RAM usage goes up from 990MB to 2.5GB)? It just doesn't make sense that it is using about 1.5GB to execute lu, and in fact, wants more!

Explain why it does not make sense. When decomposing a sparse matrix to several full matrices, it is expected the result take a lot of memory, let alone intermediate results MATLAB has to store.

Bruno

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us