octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smashing the stack


From: Dmitri A. Sergatskov
Subject: Re: Smashing the stack
Date: Fri, 25 May 2012 17:35:59 -0500

On Fri, May 25, 2012 at 4:52 PM, Dmitri A. Sergatskov
<address@hidden> wrote:
> On Fri, May 25, 2012 at 3:40 PM, Jordi Gutiérrez Hermoso
> <address@hidden> wrote:
>> This seems like a rather esoteric thing to do, but:
>>
>>    a = {}
>>    for i = 1:1e6
>>        a = {rand, a};
>>    endfor
>>
>>    for i = 2:1e6
>>        a = a{2};
>>    endfor
>>
>> This segfaults for me after a relatively long time, presumably since
>> the call stack goes up to about 1e6 stack frames.
>>
>> Is it worthwhile trying to fix this?
>>
>> - Jordi G. H.
>
> I completes fine (in less than a minute)
> on  3.6.1 and on ~2 days old dev version...
> (Fedora 16, x86_64)
>
> Dmitri.
> --
tic
a = {}
   for i = 1:1e6
       a = {rand, a};
   endfor
toc

This works fine (Elapsed time 11 sec).

If I do either
a = 1;
or just
whos a
I get a core dump.

Dmitri.
--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]