From: Walter Roberson on
Jan Simon wrote:

> and it is no crash of the JIT:
> feature('JIT', 'off');
> feature('accel', 'off');
> eval(repmat('+1', 1, 47516)) % Crash in Matlab 6.5
>
> Obviously it is the revenge of EVAL.

2008b: a function with 65020 iterations of +1 worked fine, but 66020
iterations crashes whether JIT is on or off.

I would speculate that there might be a limit of approximately 65535 nodes per
expression. I do not have any hypotheses about why eval() hits the limit earlier.

It would be interesting to try these in 2010a and 2010b as those are supposed
to JIT command lines and scripts.
From: Steven_Lord on


"Walter Roberson" <roberson(a)hushmail.com> wrote in message
news:i3abfq$1k8$1(a)canopus.cc.umanitoba.ca...
> Jan Simon wrote:
>
>> and it is no crash of the JIT:
>> feature('JIT', 'off');
>> feature('accel', 'off');
>> eval(repmat('+1', 1, 47516)) % Crash in Matlab 6.5
>>
>> Obviously it is the revenge of EVAL.
>
> 2008b: a function with 65020 iterations of +1 worked fine, but 66020
> iterations crashes whether JIT is on or off.
>
> I would speculate that there might be a limit of approximately 65535 nodes
> per expression. I do not have any hypotheses about why eval() hits the
> limit earlier.
>
> It would be interesting to try these in 2010a and 2010b as those are
> supposed to JIT command lines and scripts.

I _suspect_ this may be related in some way to bug report 611546.

http://www.mathworks.com/support/bugreports/611546

But I personally tend to agree with many of the other posters in this
thread -- if you're trying to EVAL such a long command line, you're probably
doing something you shouldn't (and I'm not just talking about using EVAL.)

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Walter Roberson on
Steven_Lord wrote:
>

> I _suspect_ this may be related in some way to bug report 611546.
>
> http://www.mathworks.com/support/bugreports/611546

2008b has no problem with eval(repmat('0',1,200000)) and doing so is
very fast, but 2008b segmentation faults on eval(repmat('+0',1,40500))
or on evaluating a function that has 66000 '+1' on a single line
(equivalent of repmat('+1',1,66000) expanded into a function .m file)

Thus I don't think this is the same issue as the bug report; I think
this is a new or different bug, or possibly even two new bugs.


I tried eval() originally as a shortcut to actually building a .m file,
figuring eval() would have the same limit as files would... looks like I
was wrong about that ;-)
From: Matt Fig on
Walter Roberson <roberson(a)hushmail.com> wrote in message
> > I _suspect_ this may be related in some way to bug report 611546.
> >
> > http://www.mathworks.com/support/bugreports/611546
>
> 2008b has no problem with eval(repmat('0',1,200000)) and doing so is
> very fast, but 2008b segmentation faults on eval(repmat('+0',1,40500))
> or on evaluating a function that has 66000 '+1' on a single line
> (equivalent of repmat('+1',1,66000) expanded into a function .m file)

Apparently not, unless I misunderstand:

function [] = test_line()
fid = fopen('myfile.m','w');
fprintf(fid,'function H = myfile()\n');
fwrite(fid,['H = 1',repmat('+1',1,70000)]);
fprintf(fid,';');
fclose(fid);

Now from the command line:

>> delete myfile.m
>> test_line
>> tic,myfile,toc
ans =
70001
Elapsed time is 49.539605 seconds.


Just don't try(!): edit myfile
2007b, win vista 32, Centrino duo @2.33 GHz, 4 GB RAM
From: Walter Roberson on
Matt Fig wrote:
> Walter Roberson <roberson(a)hushmail.com> wrote in message
>> > I _suspect_ this may be related in some way to bug report 611546.
>> > > http://www.mathworks.com/support/bugreports/611546
>>
>> 2008b has no problem with eval(repmat('0',1,200000)) and doing so is
>> very fast, but 2008b segmentation faults on eval(repmat('+0',1,40500))
>> or on evaluating a function that has 66000 '+1' on a single line
>> (equivalent of repmat('+1',1,66000) expanded into a function .m file)
>
> Apparently not, unless I misunderstand:
>
> function [] = test_line()
> fid = fopen('myfile.m','w');
> fprintf(fid,'function H = myfile()\n');
> fwrite(fid,['H = 1',repmat('+1',1,70000)]);
> fprintf(fid,';');
> fclose(fid);
>
> Now from the command line:
>
>>> delete myfile.m
>>> test_line
>>> tic,myfile,toc
> ans =
> 70001
> Elapsed time is 49.539605 seconds.

That segmentation faulted on 2008b Ubuntu (Linux) 64 bit, 12 Gb of memory
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: Matlab GUI code - zeros
Next: Optmisation problem