Got Questions? Get Answers.
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

Subject: out of memory

From: Skirt Zhang

Date: 1 Jul, 2011 09:27:11

Message: 1 of 9

Dear all,

I have a large matrix to read by block but currently I have this error message when I run the code:
"Out of memory. Type HELP MEMORY for your options."

I use the memory func to check the availability for the space, and got infor below

   MaxPossibleArrayBytes: 436731904
   MemAvailableAllArrays: 1.5326e+009
        MemUsedMATLAB: 281780224


I have customized my computer's property --- memory usage to 4.2+009

and got the infor from matlab


 sys.SystemMemory

ans =

    Available: 6.8220e+009

>> sys.VirtualAddressSpace

ans =

    Available: 1.5326e+009
        Total: 2.1474e+009

>> sys.PhysicalMemory

ans =

    Available: 2.5478e+009
        Total: 3.7153e+009

What should I do to solve this problem? (if I don't want to change the RAM?)

BIG THX in advance

Subject: out of memory

From: Steven_Lord

Date: 1 Jul, 2011 13:29:39

Message: 2 of 9



"Skirt Zhang" <silence_qunzi@hotmail.com> wrote in message
news:iuk3te$lu4$1@newscl01ah.mathworks.com...
> Dear all,
>
> I have a large matrix to read by block but currently I have this error
> message when I run the code:
> "Out of memory. Type HELP MEMORY for your options."

How big is "a large matrix"?

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: out of memory

From: Baalzamon

Date: 1 Jul, 2011 14:55:24

Message: 3 of 9

"Steven_Lord" <slord@mathworks.com> wrote in message <iuki44$s9e$1@newscl01ah.mathworks.com>...
>
>
> "Skirt Zhang" <silence_qunzi@hotmail.com> wrote in message
> news:iuk3te$lu4$1@newscl01ah.mathworks.com...
> > Dear all,
> >
> > I have a large matrix to read by block but currently I have this error
> > message when I run the code:
> > "Out of memory. Type HELP MEMORY for your options."
>
> How big is "a large matrix"?
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
To Steven Lord:

I am also about to experience this issue. My next set will involve reading in 14 files of ~180 Mb one at a time. Filtering out rubbish then saving each with dlmwrite tab delim and ideally appended together. Then the large file (and two others) need to be loaded for comparison.

As a rule I have 200 000 lines and 27 columns. For the memory issue I can drop the columns to around 18...
Would matlab be able to handle this?

Subject: out of memory

From: Skirt Zhang

Date: 1 Jul, 2011 15:00:27

Message: 4 of 9

The data I am reading by block is about 1.2GB, the block size is about

[1 6 30000000 4]


"Steven_Lord" <slord@mathworks.com> wrote in message <iuki44$s9e$1@newscl01ah.mathworks.com>...
>
>
> "Skirt Zhang" <silence_qunzi@hotmail.com> wrote in message
> news:iuk3te$lu4$1@newscl01ah.mathworks.com...
> > Dear all,
> >
> > I have a large matrix to read by block but currently I have this error
> > message when I run the code:
> > "Out of memory. Type HELP MEMORY for your options."
>
> How big is "a large matrix"?
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Subject: out of memory

From: Steven_Lord

Date: 1 Jul, 2011 16:56:49

Message: 5 of 9



"Skirt Zhang" <silence_qunzi@hotmail.com> wrote in message
news:iuknea$fps$1@newscl01ah.mathworks.com...
> The data I am reading by block is about 1.2GB, the block size is about
> [1 6 30000000 4]

Reduce the size of your block and/or free up some memory.

A matrix of real doubles of that size would require:

>> numElementsInBlock = 1*6*30000000*4;
>> memoryRequired = 8*numElementsInBlock;
>> memoryGB = memoryRequired/(1024^3)

memoryGB =

          5.36441802978516

a contiguous block of memory over 5 GB in size. You don't have that
available.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: out of memory

From: Steven_Lord

Date: 1 Jul, 2011 16:59:04

Message: 6 of 9



"Baalzamon " <baalzamon_moridin@yahoo.com> wrote in message
news:iukn4s$epq$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <iuki44$s9e$1@newscl01ah.mathworks.com>...
>>
>>
>> "Skirt Zhang" <silence_qunzi@hotmail.com> wrote in message
>> news:iuk3te$lu4$1@newscl01ah.mathworks.com...
>> > Dear all,
>> >
>> > I have a large matrix to read by block but currently I have this error
>> > message when I run the code:
>> > "Out of memory. Type HELP MEMORY for your options."
>>
>> How big is "a large matrix"?
>>
>> --
>> Steve Lord
>> slord@mathworks.com
>> To contact Technical Support use the Contact Us link on
>> http://www.mathworks.com
> To Steven Lord:
> I am also about to experience this issue. My next set will involve reading
> in 14 files of ~180 Mb one at a time. Filtering out rubbish then saving
> each with dlmwrite tab delim and ideally appended together. Then the large
> file (and two others) need to be loaded for comparison.
> As a rule I have 200 000 lines and 27 columns. For the memory issue I can
> drop the columns to around 18...
> Would matlab be able to handle this?

It falls under the theoretical limit for the maximum amount of memory MATLAB
is able to use, so as long as your system has a block of contiguous memory
that's large enough available it should.

http://www.mathworks.com/support/tech-notes/1100/1106.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: out of memory

From: Skirt Zhang

Date: 1 Jul, 2011 20:13:26

Message: 7 of 9

Dear Steven,

Thanks a lot for your kind help.

However, this code has run successfully on another computer so I am wondering it might not because MATLAB can't deal with such a large block....

So I am wondering is it possible that I could physically increase the

Memory used by MATLAB
???????????

Thanks a lot in advance





"Steven_Lord" <slord@mathworks.com> wrote in message <iuku8h$6sd$1@newscl01ah.mathworks.com>...
>
>
> "Skirt Zhang" <silence_qunzi@hotmail.com> wrote in message
> news:iuknea$fps$1@newscl01ah.mathworks.com...
> > The data I am reading by block is about 1.2GB, the block size is about
> > [1 6 30000000 4]
>
> Reduce the size of your block and/or free up some memory.
>
> A matrix of real doubles of that size would require:
>
> >> numElementsInBlock = 1*6*30000000*4;
> >> memoryRequired = 8*numElementsInBlock;
> >> memoryGB = memoryRequired/(1024^3)
>
> memoryGB =
>
> 5.36441802978516
>
> a contiguous block of memory over 5 GB in size. You don't have that
> available.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Subject: out of memory

From: Steven_Lord

Date: 1 Jul, 2011 20:28:28

Message: 8 of 9



"Skirt Zhang" <zhangqunzi@googlemail.com> wrote in message
news:iul9p6$c6f$1@newscl01ah.mathworks.com...
> Dear Steven,
>
> Thanks a lot for your kind help.
>
> However, this code has run successfully on another computer so I am
> wondering it might not because MATLAB can't deal with such a large
> block....
>
> So I am wondering is it possible that I could physically increase the
> Memory used by MATLAB
> ???????????

You could _try_ the techniques described in these two documents:

http://www.mathworks.com/support/tech-notes/1100/1106.html
http://www.mathworks.com/support/tech-notes/1100/1107.html

but you have no hope of creating a block of memory that size on a 32-bit
machine and you'd better have a LOT of memory to have a chance of doing so
on a 64-bit machine.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: out of memory

From: Baalzamon

Date: 1 Jul, 2011 22:47:09

Message: 9 of 9

Some clear food for thought here thanks.

Fortunately (?) I am running 64 bit. I shall read up on the various links you
have put up.

Side question (sorry if this is turning into a random forum)
Does anyone else experience matlab occasionally freezing?
This happens even if I am not running things.

I use 2010b under 64 bit I believe...though I will check when I return to the office tomorrow..

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