octave-maintainers
[Top][All Lists]
Advanced

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

Re: Smashing the stack


From: Doug Stewart
Subject: Re: Smashing the stack
Date: Sat, 26 May 2012 06:11:01 -0400



On Fri, May 25, 2012 at 10:41 PM, Dmitri A. Sergatskov <address@hidden> wrote:
On Fri, May 25, 2012 at 6:38 PM, Doug Stewart <address@hidden> wrote:
>
>
> On Fri, May 25, 2012 at 4: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.
>
>
> Works OK for me in the GUI with todays compile.
> octave:1> run '/home/doug/test55.m'
> a = {}(0x0)
> octave:2> whos a
> Variables in the current scope:
>
>    Attr Name        Size                     Bytes  Class
>    ==== ====        ====                     =====  =====
>         a           1x2                          8  cell
>
> Total is 2 elements using 8 bytes
>
> octave:3>
>
>
> --
> DAS
>
> https://linuxcounter.net/user/206392.html

But try with the only first loop:


 a = {}
  for i = 1:1e6
      a = {rand, a};
  endfor
whos a

Dmitri.
--

Yes Dmitri, I do get a crash like you do, if I just run the first half and then "whos a"

Doug
--
DAS

https://linuxcounter.net/user/206392.html

reply via email to

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