Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Matlab memory problems

47 views
Skip to first unread message

can baran

unread,
Jan 2, 2010, 10:08:03 PM1/2/10
to
Hey Guys,

I received the following errors from matlab:
1)
ME.identifier

ans =

MATLAB:COM:E97992

ME.message

ans =

Error: Object returned error code: 0x17EC8

2)
Warning: Insufficient memory to create worker threads

All of these errors (as you might have inferred by now) are related to opening excel via xlsread and the first error is very likely to be related to a memory issue as well as the second one.
I have the following questions:
1) Although I am pretty sure that my code does not leak memory (and I dont think that is possible to do that in matlab unless you use the new handle class), what is wrong?
2) What memory indicators can I use to monitor my memory usage? I am aware of the
m = feature('memstats');
and
s = whos;
total_bytes = {s.bytes}';
and
[userview systemview] = memory
Which output of these functions will give me the warning flag that I am running out of memory?
So, my code parses 2000+ files each of which is 10 MByte big and at each iteration (2000+ iterations), I have a few variables that grow dynamically. I really don't think it is because of those variables because even at the end of the last iteration, the biggest variable does not hold more than 10 MB+ memory.
After each iteration, userview.MemUsedMatlab increases. Why is that? that made me think that my code leaks memory, but I am not too familiar with how matlab uses/deals with memory.

Any help is very much appreciated.
Can

Steven Lord

unread,
Jan 3, 2010, 10:31:19 PM1/3/10
to

"can baran" <can_b...@yahoo.com> wrote in message
news:hhp1mj$oit$1...@fred.mathworks.com...
> Hey Guys,

*snip*

> I have the following questions:
> 1) Although I am pretty sure that my code does not leak memory (and I dont
> think that is possible to do that in matlab unless you use the new handle
> class), what is wrong? 2) What memory indicators can I use to monitor my
> memory usage? I am aware of the

*snip*

Read through the following document on our website for information about how
memory works in MATLAB:

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

--
Steve Lord
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


can baran

unread,
Jan 4, 2010, 1:15:22 PM1/4/10
to
"Steven Lord" <sl...@mathworks.com> wrote in message <hhrne2$g7g$1...@fred.mathworks.com>...

Steve thanks for the link.
I did read it.
I put some specific error warnings in my previous post. Do they mean anything ?
As for the link, I believe I need to monitor my heap space usage. What is a good way of doing this? When you call


m = feature('memstats')

which one is the indicator for heap space usage?
As for the second major cause, memory fragmentation, I dont think i can have a call to "pack" in my code. I do use the clear whenever I am doing with any variable or after saving my variable, but that does not de-fragment the memory (does it?).
I believe I run out of heapspace, I dont think it is the java heapspace.
Would you recommend increasing the swap file size to 3 gb from 2 gb as opposed to the recommendation in that link?
Thanks
Can

0 new messages